protected string GenerateRunId(LogsharkRequestTarget requestTarget, DateTime requestCreationTime) { string hostnamePrefix = Environment.MachineName; string timeStamp = requestCreationTime.ToString("yyMMddHHmmssff"); string targetSuffix = ""; if (requestTarget.IsHashId) { targetSuffix = requestTarget.Target; } else if (requestTarget.IsFile || requestTarget.IsDirectory) { targetSuffix = Path.GetFileName(requestTarget).RemoveSpecialCharacters(); } string generatedRunId = String.Format("{0}_{1}_{2}", hostnamePrefix, timeStamp, targetSuffix).ToLowerInvariant(); if (generatedRunId.Length > 60) { return(generatedRunId.Substring(0, 60)); } else { return(generatedRunId); } }
internal LogsharkRequest(string target, LogsharkConfiguration configuration) { Target = new LogsharkRequestTarget(target); Configuration = configuration; RequestCreationDate = DateTime.UtcNow; RunId = GenerateRunId(Target, RequestCreationDate); LocalMongoPort = LogsharkConstants.MONGO_LOCAL_PORT_DEFAULT; Metadata = new Dictionary <string, object>(); PluginsToExecute = new HashSet <string>(); PluginCustomArguments = new Dictionary <string, object>(); StartLocalMongo = configuration.LocalMongoOptions.AlwaysUseLocalMongo; WorkbookTags = new HashSet <string> { "Logshark", Environment.UserName }; RunContext = new LogsharkRunContext(); }