Пример #1
0
        internal static void UpdateApacheLogsDatabase(ApacheLogsDataSet dataSet)
        {
            var errorLogTableTableAdapter = new ErrorLogTableTableAdapter();
            var infoLogTableTableAdapter = new InfoLogTableTableAdapter();

            try
            {
                _connection.Open();

                errorLogTableTableAdapter.Connection = _connection;
                infoLogTableTableAdapter.Connection = _connection;

                errorLogTableTableAdapter.Update(dataSet.ErrorLogTable);
                infoLogTableTableAdapter.Update(dataSet.InfoLogTable);

                dataSet.AcceptChanges();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                _connection.Close();
            }
        }
        public void Load()
        {
            this._apacheLogsDataSet = new ApacheLogsDataSet();

            this._apachePath = ConfigurationManager.AppSettings["APACHE_HOME"];
            this._apacheConfPath = string.Concat(this._apachePath, @"conf\httpd.conf");

            this._logFormats = new Dictionary<string, string>();
            this._logPatterns = new Dictionary<string, string>();
            this._logFiles = new Dictionary<string, string>();

            this.IsLogIoModuleLoad = false;
            this.IsLogConfigModuleLoad = false;
            this.IsLogForensicModuleLoad = false;

            this.EvalApacheConf();
            this.PrepareLogPatterns();

            this.EvalErrorLog();
            this.EvalLogs();
            this.SaveData();
        }