我目前的问题是,我不知道那些Eventlogqueries的语法。我想要一个查询,它给我过去一周的所有事件
private Result<List<AssetManagementEventlogDTO>> GetEvents()
{
var eventList = new List<AssetManagementEventlogDTO>();
string queryString = " *";
SecureString pw = new SecureString();
foreach (char c in Password)
{
pw.AppendChar(c);
}
EventLogSession session = new EventLogSession(
IP, // Remote Computer
Domain, // Domain
Username, // Username
pw,
SessionAuthentication.Default);
EventLogQuery query = new EventLogQuery("Security", PathType.FilePath, queryString);
query.Session = session;
GetEventlog(query, eventList, AssetManagementEventlogType.Security);
query = new EventLogQuery("Application", PathType.FilePath, queryString);
query.Session = session;
GetEventlog(query, eventList, AssetManagementEventlogType.Application);
query = new EventLogQuery("System", PathType.FilePath, queryString);
query.Session = session;
GetEventlog(query, eventList, AssetManagementEventlogType.System);
return Result<List<AssetManagementEventlogDTO>>.AsSuccess(eventList);
}
答案 0 :(得分:2)
好的,我现在得到了它的工作原理:
create table Customers
(
customer_id int primary key
);
create table Domains
(
customer_id int references Customers(customer_id),
domain_id int,
primary key(customer_id, domain_id)
);
create table Servers
(
customer_id int references Customers(customer_id),
server_id int,
primary key(customer_id, server_id)
);
create table DomainsServers
(
customer_id int references Customers(customer_id),
domain_id int,
server_id int,
primary key(customer_id, domain_id, server_id),
foreign key fk_domains (customer_id, domain_id) references Domains(customer_id, domain_id),
foreign key fk_servers (customer_id, server_id) references Servers(customer_id, server_id),
);