locked
Using log parser in for each loops to query the logs from multiple exchange server RRS feed

  • Question

  • Hello All ,

    In my environment i would like to use the log parser tool to extract the report from the multiple exchange servers which contains logs in the following location .Could you please help me out on this requirement.

    Log location : d:\Program Files\Microsoft\Exchange\V15\Logging\HttpProxy\Mapi

    I would like to extract the logs from the above location from all the servers.

    Command i used for single server :

    LogParser.exe "Select DateTime,AuthenticatedUser,UserAgent FROM 'd:\Program Files\Microsoft\Exchange\V15\Logging\HttpProxy\Mapi\*.*' where AuthenticatedUser like '%user1%' and UserAgent like '%Microsoft Office%'" -i:CSV -o:csv > "C:\Log parser\server1\1.csv"

    How should i run this command on my utility box (i.e on the server where the log parser tool is installed) in for each loops to extract the report from multiple exchange servers which contains the log files in the above location.

    Note : In every exchange server i have logs in the above location and i have to extract it to a report.


    Thanks & Regards S.Nithyanandham

    Wednesday, January 3, 2018 9:52 AM

All replies

  • You are posting in the wrong forum.  This is a scripting forum and LogParser is not a script.

    LogParser is supported at IIS.Net https://forums.iis.net/default.aspx/51?Logparser+Forums


    \_(ツ)_/

    Wednesday, January 3, 2018 10:14 AM
  • Hello jrv , 

    Thank you and i have posted my query in mentioned forum .

    I would like to use the below mentioned command in windows powershell by using the for each loops .Please let me know if you have any ideas on this query . As i have little bit idea to input multiple values for the FROM parameter as because i need to search logs from the different servers from the given location.

    i would like to feed the values for FROM filed like below but i don't have an complete idea to create the entire powershell script structure .

    \\server1\d$\Program Files\Microsoft\Exchange\V15\Logging\HttpProxy\Mapi\*.*

    \\server2 \d$\Program Files\Microsoft\Exchange\V15\Logging\HttpProxy\Mapi\*.*

    LogParser.exe "Select DateTime,AuthenticatedUser,UserAgent FROM 'd:\Program Files\Microsoft\Exchange\V15\Logging\HttpProxy\Mapi\*.*' where AuthenticatedUser like '%user1%' and UserAgent like '%Microsoft Office%'" -i:CSV -o:csv > "C:\Log parser\server1\1.csv"


    Thanks & Regards S.Nithyanandham

    Thursday, January 4, 2018 4:35 AM
  • help foreach -online

    Look at the examples.


    \_(ツ)_/

    Thursday, January 4, 2018 8:51 AM
  • Hi Nithyanandham,

    I am facing the same kind of issue and looking for help. 

    Please assist me to read IIS logs from different servers as we have multiple servers in our farm. If you got the answer please share the link.

    Regards,

    Gourav Kapoor

    Friday, October 19, 2018 3:37 PM
  • hi Nithyanandham

    take a look of Microsofts Power BI. It's very very cool to read many LOGs

    https://powerbi.microsoft.com/en-us/integrations/exchange/



    Chris

    Friday, October 19, 2018 4:22 PM
  • This is a basic foreach loop.

    foreach ($server in 'server1','server2','server3') {
      echo "the server is $server"
    }

    the server is server1
    the server is server2
    the server is server3

    • Edited by JS2010 Saturday, October 20, 2018 6:36 PM
    Saturday, October 20, 2018 1:56 PM