title: query a custom eventlog searching for EventID
body: <p>[DISCLAIMER]I'm pretty new to C# and I'm not a programmer![/DISCLAIMER]</p>
  
  <p>I am following the example located here(<a href="https://stackoverflow.com/questions/2462426/c-how-to-query-for-an-event-log-details-with-a-given-event-id">C#: How to Query for an event log details with a given event id?</a>) to search for a given eventid in a custom eventlog.</p>
  
  <p>The code in that example is:</p>
  
  <pre><code>string eventID = "5312";
  string LogSource = "Microsoft-Windows-GroupPolicy/Operational";  
  string sQuery = "*[System/EventID=" + eventID + "]";
  
  var elQuery = new EventLogQuery(LogSource, PathType.LogName, sQuery);
  var elReader = new System.Diagnostics.Eventing.Reader.EventLogReader(elQuery);
  
  List&lt;EventRecord&gt; eventList = new List&lt;EventRecord&gt;();
  for (EventRecord eventInstance = elReader.ReadEvent();
      null != eventInstance; eventInstance = elReader.ReadEvent())
  {
      eventList.Add(eventInstance);
  }
  </code></pre>
  
  <p>In my application I created an eventlog called "SMCLogs" and the LogSource is "SAM2_SMCLogs" so I changed to above code as follows:</p>
  
  <pre><code>string eventID = "330";
  string LogSource = "SAM2_SMCLogs";  
  string sQuery = "*[SMCLogs/EventID=" + eventID + "]";
  
  var elQuery = new EventLogQuery(LogSource, PathType.LogName, sQuery);
  var elReader = new System.Diagnostics.Eventing.Reader.EventLogReader(elQuery);
  
  List&lt;EventRecord&gt; eventList = new List&lt;EventRecord&gt;();
  for (EventRecord eventInstance = elReader.ReadEvent();
      null != eventInstance; eventInstance = elReader.ReadEvent())
  {
      eventList.Add(eventInstance);
  }
  </code></pre>
  
  <p>But I get the error: "<b>The specified channel could not be found. Check channel configuration</b>"</p>
  
  <p>What am I doing wrong?</p>