Question

I can access the local system event log information using "." and "Machinename". but i cannnot access the local system event log by using ip address.

the code is:

EventLog Logs = new EventLog("Application",".");//EventLog("Application","Machinename");

this also works fine. but when i am using it for ip address like

EventLog Logs = new EventLog("Application","XXX.XX.X.X");

please help me to resolve this.

Thanks in Advance..

Was it helpful?

Solution

Try converting the IP address to a host name using Dns.GetHostEntry:

using System.Net;

string hostName = Dns.GetHostEntry("xxx.xx.x.x").HostName.Split('.')[0];
    EventLog log = new EventLog("Application", hostName);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top