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); } }
private static string GenerateRunId(LogsharkRequestTarget requestTarget, DateTime requestCreationTime) { var hostnamePrefix = Environment.MachineName; var timeStamp = requestCreationTime.ToString("yyMMddHHmmssff"); var targetSuffix = requestTarget.Type == LogsetTarget.Hash ? requestTarget.Target : Path.GetFileName(requestTarget).RemoveSpecialCharacters(); return($"{hostnamePrefix}_{timeStamp}_{targetSuffix}" .ToLowerInvariant() .Left(60)); }
internal LogsharkRequest(string target, LogsharkConfiguration configuration) { Target = new LogsharkRequestTarget(target); Configuration = configuration; RequestCreationDate = DateTime.UtcNow; RunId = GenerateRunId(Target, RequestCreationDate); Source = "Unspecified"; LocalMongoPort = MongoLocalPortDefault; 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 }; }
internal LogsharkRequest(string target, LogsharkConfiguration configuration) { Target = new LogsharkRequestTarget(target); Configuration = configuration; RequestCreationDate = DateTime.UtcNow; RunId = GenerateRunId(Target, RequestCreationDate); LocalMongoPort = RequestConstants.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(); }
protected string GenerateRunId(LogsharkRequestTarget requestTarget, DateTime requestCreationTime) { string hostnamePrefix = Environment.MachineName; string timeStamp = requestCreationTime.ToString("yyMMddHHmmssff"); string targetSuffix; if (requestTarget.Type == LogsetTarget.Hash) { targetSuffix = requestTarget.Target; } else { targetSuffix = Path.GetFileName(requestTarget).RemoveSpecialCharacters(); } return(String.Format("{0}_{1}_{2}", hostnamePrefix, timeStamp, targetSuffix) .ToLowerInvariant() .Left(60)); }