protected BaseLogParser(string logFile, EnumLogFile logFileFormat) { LogFile = logFile; LogFileFormat = logFileFormat; Initilaize(); }
public IPAddressFeature(EnumLogFile logFile) : base(logFile) { _featureName = LogFeature.IPADDRESS; _logs.Add("General", new LogCollection()); _logs.Add("IPPage", new LogCollection()); }
public LogInfoEventArgs(string fileName, EnumLogFile logFormat, LogProcessStatus logStatus, string calledMethod, string message) { FileName = fileName; LogFormat = logFormat; CalledMethod = calledMethod; Message = message; LogStatus = logStatus; }
public AccessPageFeature(EnumLogFile logFile) : base(logFile) { _featureName = LogFeature.ACCESS; LogCollection log = new LogCollection(); _logs.Add("General", log); }
public HitsFeature(EnumLogFile logFile) : base(logFile) { _featureName = LogFeature.HITS; LogCollection log = new LogCollection(); _logs.Add("General", log); }
public AccessStatusFeature(EnumLogFile logFile) : base(logFile) { _featureName = LogFeature.STATUS; LogCollection log = new LogCollection(); _logs.Add("General", log); }
public BandwidthFeature(EnumLogFile logFile) : base(logFile) { _featureName = LogFeature.BANDWIDTH; _logs.Add("BytesSent", new LogCollection()); _logs.Add("ByteReceived", new LogCollection()); _logs.Add("ByteIPClient", new LogCollection()); }
public GeneralFeature1(EnumLogFile logFile) : base(logFile) { _featureName = LogFeature.GENERAL; _logs.Add("General", new LogCollection()); _logs.Add("IPServer", new LogCollection()); _logs.Add("TotalData", new LogCollection()); }
public RequestFeature(EnumLogFile logFile) : base(logFile) { _featureName = LogFeature.REQUEST; LogCollection log = new LogCollection(); _logs.Add("TimeTaken", log); }
public UserAgentFeature(EnumLogFile logFile) : base(logFile) { _featureName = LogFeature.USERAGENT; LogCollection log = new LogCollection(); _logs.Add("General", log); }
public GeneralFeature(EnumLogFile logFile) : base(logFile) { _featureName = LogFeature.GENERAL; _fields.Add("s-ip"); _fields.Add("total"); _fields.Add("min-date"); _fields.Add("max-date"); }
public static BaseLogParser CreateParserByType(EnumLogFile logFormat) { BaseLogParser baseParser = null; string asm = ConfigurationManager.AppSettings[logFormat.ToString()]; if (!string.IsNullOrEmpty(asm)) { object[] pars = new object[] { "", logFormat }; baseParser = (BaseLogParser)Activator.CreateInstance(Type.GetType(asm, true), pars); } return(baseParser); }
private static EnumLogFile GetLogFormat(string logFile) { EnumLogFile logFormat = EnumLogFile.UNKNOWN; if (File.Exists(logFile)) { bool bRead = false; DateTime dt = DateTime.Now; string strError = "(unknown)"; retry: if (((DateTime.Now - dt).TotalSeconds > 5) && (System.Windows.Forms.MessageBox.Show("Timed out trying to open log file:\n\n" + logFile + "\n\nError: " + strError + "\n\nTry again?", "Time out", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning, System.Windows.Forms.MessageBoxDefaultButton.Button1) != System.Windows.Forms.DialogResult.Yes)) { return(logFormat); } try { //using (StreamReader sr = new StreamReader(logFile)) using (FileStream fs = File.Open(logFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { bRead = true; using (StreamReader sr = new StreamReader(fs)) { string l1 = sr.ReadLine(); string l2 = sr.ReadLine(); string l3 = sr.ReadLine(); if (l1.StartsWith("#") && l2.StartsWith("#") && l3.StartsWith("#")) { logFormat = EnumLogFile.W3CEXT; } } } } /*catch (IOException) * { * // * }*/ catch (Exception ex) { strError = ex.Message; } if (bRead == false) { goto retry; } } return(logFormat); }
public static BaseLogParser CreateParser(string logFile) { BaseLogParser baseParser = null; EnumLogFile logFormat = EnumLogFile.UNKNOWN; if (logFile.StartsWith("--")) { List <EnumLogFile> listLogFormat = new List <EnumLogFile>(); string tmp = logFile.Substring(2); string[] files = tmp.Split(new char[] { ';' }); for (int i = 0; i < files.Length; i++) { if (!string.IsNullOrEmpty(files[i])) { EnumLogFile tmpLog = GetLogFormat(files[i]); if (!listLogFormat.Contains(tmpLog)) { listLogFormat.Add(tmpLog); } } } // check double log format if (listLogFormat.Count > 1) { return(null); } logFormat = listLogFormat[0]; } else { logFormat = GetLogFormat(logFile); } string asm = ConfigurationManager.AppSettings[logFormat.ToString()]; if (!string.IsNullOrEmpty(asm)) { object[] pars = new object[] { logFile, logFormat }; baseParser = (BaseLogParser)Activator.CreateInstance(Type.GetType(asm, true), pars); } return(baseParser); }
private static EnumLogFile GetLogFormat(string logFile) { EnumLogFile logFormat = EnumLogFile.UNKNOWN; if (File.Exists(logFile)) { using (StreamReader sr = new StreamReader(logFile)) { string l1 = sr.ReadLine(); string l2 = sr.ReadLine(); string l3 = sr.ReadLine(); if (l1.StartsWith("#") && l2.StartsWith("#") && l3.StartsWith("#")) { logFormat = EnumLogFile.W3CEXT; } } } return(logFormat); }
public W3cExtendedLogParser(string logFile, EnumLogFile logFileFormat) : base(logFile, logFileFormat) { }
public BaseLogAnalyzeFeature(EnumLogFile logFile) { _logFile = logFile; }
public BaseFeature(EnumLogFile logFile) { _logFile = logFile; }