コード例 #1
0
        public BackgrounderSubscriptionJobDetail(BackgrounderJob backgrounderJob, IList <BsonDocument> subscriptionJobEvents)
        {
            BackgrounderJobId = backgrounderJob.JobId;

            foreach (var subscriptionJobEvent in subscriptionJobEvents)
            {
                string className = BsonDocumentHelper.GetString("class", subscriptionJobEvent);
                string message   = BsonDocumentHelper.GetString("message", subscriptionJobEvent);

                if (className.Equals(BackgrounderConstants.VqlSessionServiceClass))
                {
                    if (message.StartsWith("Created session id:"))
                    {
                        VizqlSessionId = message.Split(':')[1];
                    }
                }

                if (className.Equals(BackgrounderConstants.SubscriptionRunnerClass) || className.Equals(BackgrounderConstants.EmailHelperClass))
                {
                    if (message.StartsWith("Sending email from"))
                    {
                        var chunks = message.Replace("Sending email from", "").Replace(" to ", " ").Replace(" from server ", " ").Trim().Split(' ');
                        SenderEmail    = chunks[0];
                        RecipientEmail = chunks[1];
                        SmtpServer     = chunks[2];
                    }

                    if (message.StartsWith("Starting subscription"))
                    {
                        SubscriptionName = message.Split('"')[1];
                    }
                }
            }
        }
コード例 #2
0
        public BackgrounderExtractJobDetail(BackgrounderJob backgrounderJob, IEnumerable <BsonDocument> vqlSessionServiceEvents)
        {
            BackgrounderJobId        = backgrounderJob.JobId;
            BackgrounderJobEventHash = backgrounderJob.EventHash;
            ParseBackgroundJobArgs(backgrounderJob.Args);
            foreach (var vqlSessionServiceEvent in vqlSessionServiceEvents)
            {
                string message = BsonDocumentHelper.GetString("message", vqlSessionServiceEvent);

                if (message.StartsWith("Created session id:"))
                {
                    string sessionPrefix = message.Split(':')[1];
                    string sessionSuffix = GetSessionSuffix(vqlSessionServiceEvent);

                    VizqlSessionId = sessionPrefix + "-" + sessionSuffix;
                }

                if (message.StartsWith("Storing to repository:"))
                {
                    var messageChunks = message.Replace("Storing to repository:", "").Split(' ').ToList();
                    foreach (var chunk in messageChunks)
                    {
                        if (chunk.Contains("/extract"))
                        {
                            ExtractUrl = chunk.Split('/')[0];
                        }

                        if (chunk.Contains("repoExtractId:"))
                        {
                            ExtractId = chunk.Split(':')[1];
                        }

                        if (chunk.Contains("(guid={"))
                        {
                            ExtractGuid = chunk.Replace("(guid={", "").Replace("})", "");
                        }

                        if (chunk.Contains("size:"))
                        {
                            TwbSize = Int64.Parse(chunk.Split(':')[1]);
                        }
                    }
                    TotalSize   = Int64.Parse(messageChunks.Last());
                    ExtractSize = TotalSize - TwbSize;
                }
            }
        }
コード例 #3
0
        public BackgrounderExtractJobDetail(BackgrounderJob backgrounderJob, IEnumerable <BsonDocument> vqlSessionServiceEvents)
        {
            BackgrounderJobId        = backgrounderJob.JobId;
            BackgrounderJobEventHash = backgrounderJob.EventHash;
            ParseBackgroundJobArgs(backgrounderJob.Args);
            foreach (var vqlSessionServiceEvent in vqlSessionServiceEvents)
            {
                string message = BsonDocumentHelper.GetString("message", vqlSessionServiceEvent);

                if (message.StartsWith("Created session id:"))
                {
                    string sessionPrefix = message.Split(':')[1];
                    string sessionSuffix = GetSessionSuffix(vqlSessionServiceEvent);

                    VizqlSessionId = sessionPrefix + "-" + sessionSuffix;
                }
                else if (message.StartsWith("Storing"))
                {
                    IDictionary <string, string> extractDetails = vqlSessionExtractDetailsRegex.MatchNamedCaptures(message);

                    if (extractDetails.ContainsKey("extract_url"))
                    {
                        ExtractUrl = extractDetails["extract_url"];
                    }
                    if (extractDetails.ContainsKey("extract_id"))
                    {
                        ExtractId = extractDetails["extract_id"];
                    }
                    if (extractDetails.ContainsKey("extract_guid"))
                    {
                        ExtractGuid = extractDetails["extract_guid"];
                    }
                    if (extractDetails.ContainsKey("twb_size"))
                    {
                        TwbSize = Int64.Parse(extractDetails["twb_size"]);
                    }
                    if (extractDetails.ContainsKey("extract_size"))
                    {
                        ExtractSize = Int64.Parse(extractDetails["extract_size"]);
                    }
                    if (extractDetails.ContainsKey("total_size"))
                    {
                        TotalSize = Int64.Parse(extractDetails["total_size"]);
                    }
                }
            }
        }