public void EventLoggingCountSystemLog()
 {
     string host = Settings.Hostname;
     string username = Settings.Username;
     string password = Settings.Password;
     EventLogging target = new EventLogging(host, username, password);
     var system = target.Count(Settings.EventLogName);
     Assert.IsTrue(system > 0, "No Events in System log, check why");
 }
        public void GetAllTest()
        {
            string host = Settings.Hostname;
            string username = Settings.Username;
            string password = Settings.Password;
            EventLogging target = new EventLogging(host, username, password);
            string logName = Settings.EventLogName;

            var count = target.Count(logName);

            var actual = target.GetAll(logName);
            Assert.AreEqual(count, actual.Count, "Asked for all log events, got different than count");
        }
        public void GetTest()
        {
            string host = Settings.Hostname;
            string username = Settings.Username;
            string password = Settings.Password;
            EventLogging target = new EventLogging(host, username, password);
            string logName = Settings.EventLogName;
            int startIndex = 0;
            int length = 5;

            var actual = target.Get(logName, startIndex, length);

            Assert.AreEqual(length, actual.Count, "Asked for 5 log events, got other");
        }
        public static EventLogEntry GetFirst()
        {
            if (_entry == null)
            {
                string host = Settings.Hostname;
                string username = Settings.Username;
                string password = Settings.Password;
                EventLogging target = new EventLogging(host, username, password);
                string logName = Settings.EventLogName;

                _entry = target.GetAll(logName).FirstOrDefault();
            }
            return _entry;
        }
Beispiel #5
0
        public ActionResult Logs(string serverName)
        {
            var authres = CheckAuthorizationAndLog(Audit.AuditTypeEnum.ViewEventLog, true, serverName,"","", "view log");
            if (authres != null)
                return authres;

            var el = new EventLogging(serverName, Session["Username"] as string, Session["Password"] as string);
            {
                var start = 0;
                var length = (el.Count("DNS Server") < 100) ? el.Count("DNS Server") : 100;
                ViewData["start"] = start;
                ViewData["length"] = length;

                var entries = el.Get("DNS Server", start, length);

                ViewData["entries"] = entries;
            }

            return View();
        }