zoukankan      html  css  js  c++  java
  • 获取安全日志信息

    实现效果:

      

    知识运用:

      EventLog类的Log属性  Entries属性  

      EventLogEntryCollection类的Count属性 及 EventLogEntry类的相关属性

    实现代码:

            private void button1_Click(object sender, EventArgs e)
            {
                this.eventLog1.Log = "Security";
                EventLogEntryCollection collection = eventLog1.Entries;
                string info = "显示安全性日志" + collection.Count + "个事件";
                foreach (EventLogEntry entry in collection)
                { 
                    info+="
    
    日志类型:"+entry.EntryType;
                        info+="
    
    日志日期;"+entry.TimeGenerated.ToLongDateString();
                            info+="
    
    日志时间:"+entry.TimeGenerated.ToLongTimeString();
                                info+="
    
    日志来源:"+entry.Source;
                                    info+="
    
    日志事件:"+entry.EventID.ToString();
                                        info+="
    
    日志用户:"+entry.UserName;
                                        info += "
    
    日志主机:" + entry.MachineName;
                }
                richTextBox1.Text = info;
            }
    

      

  • 相关阅读:
    memset 还可以这样用
    搜索(DFS)
    搜索(BFS)
    最大流之sap算法
    最大流之sap算法
    String VS Cstring(字符串)
    String VS Cstring(字符串)
    Set 与 Multiset
    deque(双端队列)
    枚举 TODO
  • 原文地址:https://www.cnblogs.com/feiyucha/p/10300338.html
Copyright © 2011-2022 走看看