« Previous Next »

Thread: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

Last post 10-28-2009 8:46 PM by qbernard. 13 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (14 items)

Sort Posts:

  • 10-05-2009, 5:17 PM

    • saphua
    • Not Ranked
    • Joined on 01-27-2009, 2:04 PM
    • Posts 7

    Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    Hi there,

    I've made a WinForms application that gets the traffic of a single site. This works perfectly, until I decided to make a WebForms application out of it instead. The exact same code (see below) now throws the following exception:

    System.IO.FileNotFoundException: Error executing query: Cannot open : Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    The exception makes sence, since all log files are prefixed with 'u_ex' and not 'ex'. It's just strange that it does work when ran from a WinForms application.

    Could anyone please help me with this?

    Thanks!

    Code:

    private void UpdateByDateRange(DateTime dateFrom, DateTime dateTo)

    {

    string siteId = Request.ServerVariables["INSTANCE_ID"];

    LogQueryClassClass logger = new LogQueryClassClass();

    COMIISW3CInputContextClass inputContext = new COMIISW3CInputContextClassClass();

    string query = "SELECT SUM(TO_REAL(sc-bytes)) AS sentTotal, SUM(TO_REAL(cs-bytes)) AS receivedTotal FROM <" + siteId + "> WHERE TO_TIMESTAMP(date, time) >= TO_TIMESTAMP('" + dateFrom.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-MM-dd HH:mm:ss') AND TO_TIMESTAMP(date, time) <= TO_TIMESTAMP('" + dateTo.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-MM-dd HH:mm:ss')";

    ILogRecord record = logger.Execute(query, inputContext).getRecord();

    decimal trafficSent = decimal.Parse(record.getValue("sentTotal").ToString());

    decimal trafficReceived = decimal.Parse(record.getValue("receivedTotal").ToString());

    // ...

    }

  • 10-10-2009, 6:51 AM In reply to

    • saphua
    • Not Ranked
    • Joined on 01-27-2009, 2:04 PM
    • Posts 7

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    Bump
  • 10-17-2009, 1:47 PM In reply to

    • saphua
    • Not Ranked
    • Joined on 01-27-2009, 2:04 PM
    • Posts 7

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    Bump (2)

  • 10-26-2009, 12:54 AM In reply to

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    Interesting.. have no ideas why WebForm is trying to look for ex* and not u_ex if you are querying siteid. I did a simple one from command line <w3svc/1> and it reads *.log I believed so u_ex* is included. if you change it to simple query say "select * from siteid", same behavior? 

    Cheers,
    Bernard Cheah
  • 10-26-2009, 4:11 PM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    What version of IIS are you using? When input format is iisw3c, logparser expects log files to be "ex*" or "u_ex*" depending on if codepage is utf8 or not. There are bunch of things which controls how logparser determines the effective codepage for the query like system code page, value of iCodePage property on IISW3CInputContext, IIS setting logInUtf8 etc. It seems you have logInUtf8 IIS property set and that is why IIS is generating logs in files "u_ex*" but logparser is not detecting it properly. I would suggest playing with iCodePage property and see if setting it to UTF8 works.

    Thanks.
    Kanwal

    Follow me on twitter at http://twitter.com/kjsingla
  • 10-26-2009, 10:34 PM In reply to

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    Wohh.. that's some good detail about LP detecting the codepage! by default I think w2k8 is set for utf logging, which is why a simple select from command line with read all u_ex*.

     

    Cheers,
    Bernard Cheah
  • 10-27-2009, 12:00 PM In reply to

    • saphua
    • Not Ranked
    • Joined on 01-27-2009, 2:04 PM
    • Posts 7

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    Thanks for the replies.

    The only thing I could find about the codepage property, was that 65001 is supposed to be utf8. This gave me the code below, but I am still getting the same exception.

    I am running on Windows Server 2008 with default IIS settings for Logging.
    Format: W3C
    Encoding: UTF-8

    LogQueryClassClass logger = new LogQueryClassClass();
    COMIISW3CInputContextClass inputContext = new COMIISW3CInputContextClass();
    inputContext.codepage = 65001;
    string query = "SELECT * FROM <" + siteId + ">";
    ILogRecordset records = logger.Execute(query, inputContext);
  • 10-27-2009, 12:14 PM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    Hi,

    Can you try setting codepage property to 0? Logparser help says 0 means it will use system codepage. Default is -2 which means it will try to automatically detect the codepage.

    Thanks.
    Kanwal

    Follow me on twitter at http://twitter.com/kjsingla
  • 10-27-2009, 12:44 PM In reply to

    • saphua
    • Not Ranked
    • Joined on 01-27-2009, 2:04 PM
    • Posts 7

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    Thanks but that didn't work. I've tried every value from -3000 to 3000, but without succes :(

  • 10-28-2009, 2:38 AM In reply to

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    Ouch.. so the codepage setting is not picking up what it suppose to read from the site id.
    Cheers,
    Bernard Cheah
  • 10-28-2009, 5:43 AM In reply to

    • saphua
    • Not Ranked
    • Joined on 01-27-2009, 2:04 PM
    • Posts 7

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    I guess so..

    What other options do I have?

  • 10-28-2009, 2:50 PM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    Hmmm. Don't know whats going on. How about using "select * from c:\inetpub\logs\logfiles\w3svc" + siteid + "\u_ex*.log"?

    Follow me on twitter at http://twitter.com/kjsingla
  • 10-28-2009, 3:45 PM In reply to

    • saphua
    • Not Ranked
    • Joined on 01-27-2009, 2:04 PM
    • Posts 7

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    Awesome! Fixed it with ksingla's suggestion. Query is now changed to:

    string query = @"SELECT SUM(TO_REAL(sc-bytes)) AS sentTotal, SUM(TO_REAL(cs-bytes)) AS receivedTotal FROM c:\inetpub\logs\logfiles\w3svc" + siteId + @"\u_ex*.log WHERE TO_TIMESTAMP(date, time) >= TO_TIMESTAMP('" + dateFrom.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-MM-dd HH:mm:ss') AND TO_TIMESTAMP(date, time) <= TO_TIMESTAMP('" + dateTo.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-MM-dd HH:mm:ss')";

    I didn't even knew this was possbile (first time working with LogParser), but I'm getting some idea about just how powerfull this tool is.

    Anywho, I'm guessing the problem I had was due to a bug? I hope one of the devs will pick it up.

    Thanks everyone!

  • 10-28-2009, 8:46 PM In reply to

    Re: Cannot find any file matching "C:\inetpub\logs\LogFiles\W3SVC4\ex*.log"

    haha ! nice workaround. so this sound like a bug where LP can't get hold of the target * file based on IIS codepage setting.
    Cheers,
    Bernard Cheah
Page 1 of 1 (14 items)
Microsoft Communities