« Previous Next »

Not Answered Thread: Merging IIS logs

Last post 08-29-2009 9:36 AM by gluegood. 12 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (13 items)

Sort Posts:

  • 08-08-2009, 4:19 PM

    • bigluz
    • Not Ranked
    • Joined on 08-08-2009, 8:17 PM
    • Posts 5

    Merging IIS logs

    I need to write a script to merge two or more IIS logs. Any help will be greatly appreciated.

  • 08-09-2009, 9:14 PM In reply to

    Re: Merging IIS logs

    I would look at using log parser to merge files.   It can help filter or get the raw data.

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 08-10-2009, 8:58 AM In reply to

    • bigluz
    • Not Ranked
    • Joined on 08-08-2009, 8:17 PM
    • Posts 5

    Re: Merging IIS logs

    My boss just asked me to start writing scripts. It has been a while since I have had to do this. I looked through log parser and the script I created keeps failing. Do you have a sample script I could use. thank you for replying and I appreciate your help

  • 08-10-2009, 12:28 PM In reply to

    Re: Merging IIS logs

    i've not tested this, but here is a sample

    logparser -i:iisw3c "select * into Combo.log from Logfile1.log, Logfile.log" -o:w3c

     

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 08-10-2009, 1:12 PM In reply to

    • bigluz
    • Not Ranked
    • Joined on 08-08-2009, 8:17 PM
    • Posts 5

    Re: Merging IIS logs

    Thank you Steve. Would I copy the sample you provided into notepad and configure it to my needs and give it a .vbs extension or actually put that into Log Parser and run it from there? Thanks again for the help

  • 08-10-2009, 10:58 PM In reply to

    Re: Merging IIS logs

    You could use a VBS file or a straight batch file

    Open Notepad, call it combine.cmd

    Download log parser 

    Add this line

    "c:\Program Files\Logparser\LogParser.exe" -i:iisw3c "select * into combo.log from fileone.log, filetwo.log" -o:w3c

    save the file, open a command prompt and see the results.  Hope that helps with the concept.

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 08-11-2009, 11:49 AM In reply to

    • bigluz
    • Not Ranked
    • Joined on 08-08-2009, 8:17 PM
    • Posts 5

    Re: Merging IIS logs

    I'm sorry if I sound like an idiot. But when you say "add this line", what am I adding it to? Again thank you for your patience and help

  • 08-11-2009, 9:23 PM In reply to

    • toerned
    • Not Ranked
    • Joined on 08-12-2009, 1:08 AM
    • Posts 2

    Re: Merging IIS logs

    In a situation where a webserver is serving >100 websites, that machine being migrated to new hardware using imaging, the new machine brought up running at a new IP address, dns changed from old to new, and a few days later the old hardware was stopped; you end up with web server log files that have duplicates (first day up to image creation moment) and unique values over 2 different files.

    Removing duplicates seems theoretically possible by using sql distinct: logparser.exe -i:iisw3c "select distinct * into combo.log from fileone.log, filetwo.log" -o:iisw3c

    Question: is there a shortcut command for walking down all directories, and combining identical named files? In our situation we could use something like: logparser.exe -i:iisw3c "select distinct * into e:\inetpub\logs\*as input*\ex*as input*.log from e:\inetpub\logs2\*input*\ex*input*.log, e:\inetpub\logs\*as input*\ex*as input*.log" -o:iisw3c

  • 08-11-2009, 9:26 PM In reply to

    • toerned
    • Not Ranked
    • Joined on 08-12-2009, 1:08 AM
    • Posts 2

    Re: Merging IIS logs

    @bigluz: to a file in your text editor, in this example notepad, where the file should be saved with the name combine.cmd

  • 08-12-2009, 9:46 AM In reply to

    • bigluz
    • Not Ranked
    • Joined on 08-08-2009, 8:17 PM
    • Posts 5

    Re: Merging IIS logs

    Thank you guys. So in notepad, my script should look like this?

    c:\Progra~1\Logparser\LogParser.exe" -i:iisw3c "select * into combo.log from fileone.log, filetwo.log" -o:w3c

    This keeps failing. I know I sound like an amateur but I am trying to re learn this stuff and impress the boss at the same time. he is testing me....ugh!!! 

     

  • 08-12-2009, 11:25 AM In reply to

    Re: Merging IIS logs

     Well doe sthe commnad

    c:\Progra~1\Logparser\LogParser.exe" -i:iisw3c "select * into combo.log from fileone.log, filetwo.log" -o:w3c

    work at a command prompt.

    Get it working from there then script/batch it.

  • 08-12-2009, 4:09 PM In reply to

    Re: Merging IIS logs

    toerned:
    Question: is there a shortcut command for walking down all directories, and combining identical named files?
     

    Yes, there is. It is the -recurse option which allows you to collect log files from multiple web servers into sub-directories and get log parser to recurse through each sub-directory.

    Regards,

    Paul Lynch | www.iisadmin.co.uk
  • 08-29-2009, 9:36 AM In reply to

    Re: Merging IIS logs

    Bigluz  - Firstly.  I feel this post shouldn't be in the advanced section.  What you are asking is quite basic LogParser functionality. 

    Secondly, have you read the online help in LogParser?

    Thirdly, do the following.

    1. Download and install LogParser from the Microsoft site
    2. Goto the Start Menu, select Start->Run.  Type cmd and hit enter
    3. In the command window type :- cd "C:\Program Files\Logparser\" then hit enter
    4. In the command window type :- LogParser.exe -i:iisw3c "select * into combo.log from fileone.log, filetwo.log" -o:w3c
    replace fileone.log and filetwo.log with the exact path of the files you are quering.

    Thanks
    Gluegood
    www.gluegood.blogspot.com

     

Page 1 of 1 (13 items)
Microsoft Communities