Welcome to Port3101.org : Your BES Connection Mark forums read | View Forum Leaders
Port3101.org : Your BES Connection



Reply
LinkBack Thread Tools Display Modes
script to check logs
 
  #1 (permalink)  
Old 07-09-2009, 08:28 AM
BES Activated
 
Join Date: Jul 2009
Location: N/A
Posts: 9
Talking script to check logs

Hi All

This is my first post and i though i would start with an addition.

This script will prompt for a bes server, a messageant the user is in and then the error or users name. I will return anything with the users name in it or anything with th error messge. I have found this wot work great when you are looking for a specific issue or to see if many users are being affected. If there are any questions or issues pleas elet me know.

cls
@Echo Off
REM This will allow parsing of bes logs
REM ***************sets proper date format********************

FOR /f "tokens=1-4 delims=/ " %%G IN ('ECHO %date%') DO (
SET MN=%%H
SET DY=%%I
SET YR=%%J)

REM ********************Asks for input for proper agent log ****************

set INPUT=
set /P INPUT=Enter Bes Server user is on: %=%

if %input% == "put your bes server name here without quotes" goto bes1
if %input% == "put your bes server name here without quotes"

REM ***** This is the part that parses the information *********

:bes1
set log=
set /P log=Enter message Agent(can be found in email error message): %=%
set / usr=
set /p usr=Enter NT Logon Name or Error:%=%

find /i "%usr%" "BES SERVER NAME HERE\Program Files\Research In Motion\BlackBerry Enterprise Server\Logs\%yr%%mn%%dy%\BES SERVER NAME HERE_magt_0%log%_%yr%%mn%%dy%_0001.txt" > "c:\%usr%.txt"
notepad "c:\%usr%.txt"
goto exit


:bes2
set log=
set /P log=Enter message Agent(can be found in email error message): %=%
set / usr=
set /p usr=Enter NT Logon Name or Error:%=%

find /i "%usr%" "\\BES SERVER NAME HERE to full log path\Research In Motion\BlackBerry Enterprise Server\Logs\%yr%%mn%%dy%\BES SERVER NAME HERE_magt_0%log%_%yr%%mn%%dy%_0001.txt" > "c:\%usr%.txt"
notepad "c:\%usr%.txt"
goto exit

pause

:exit
exit
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-09-2009, 09:34 AM
hdawg's Avatar
Proprietor
 
Join Date: Nov 2008
Posts: 2,257
Blog Entries: 147
Default

Great first post!

It looks like from reading the script it executes the command over the network ... so the directory with the logs in it needs to be shared out; right?
__________________
http://blog.port3101.org/hdawg/
Reply With Quote
  #3 (permalink)  
Old 07-09-2009, 09:56 AM
BES Activated
 
Join Date: Jul 2009
Location: N/A
Posts: 9
Default

No it does not have to be shared out as long as you have access to the "drive letter"$ i put in \\servername\c$\bes log paths. This way it can be configured if the paths are in different locations as we EX: \\servername\e$\bes log path
Reply With Quote
  #4 (permalink)  
Old 07-09-2009, 10:30 AM
hdawg's Avatar
Proprietor
 
Join Date: Nov 2008
Posts: 2,257
Blog Entries: 147
Default

gotcha
__________________
http://blog.port3101.org/hdawg/
Reply With Quote
  #5 (permalink)  
Old 07-09-2009, 08:45 PM
Otto's Avatar
Proprietor
 
Join Date: Nov 2008
Location: Atlanta, GA
Posts: 2,033
Blog Entries: 14
Default

In that case, shouldn't the 'find /i "%usr%"' line for both bes1 and bes2 be the same? Your syntax differs from one to the other (the second appearing to be the correct one). And even then, why not look at automating it with a SQL query against the database to gather the agent number and BES server information (name and agent), a corresponding remote registry lookup for the log file location (unless that's in the database - can't remember), and then load all that information dynamically for the remote search. Now, as to how to do all of that, it shouldn't be hard, but that's not my cup of tea
__________________
BCSA (4.1, 5.0) | BCSD (4.1, 5.0)

The views expressed by me on Port3101.org are my own and do not necessarily reflect the views of my employer.
Reply With Quote
  #6 (permalink)  
Old 07-10-2009, 07:49 AM
BES Activated
 
Join Date: Jul 2009
Location: N/A
Posts: 9
Default

This was created for anyone to use as long as they have access to the logs. If they don't it is very easy to do so. Giving access to the database even just view can be dangerous. We have over 5000 handhelds with 6 BES servers. The people that are allowed to have a blackberry are execs. We do not want people who have access to the database gathering other information that they should not have. By giving access just to the logs techs can look at issues if they arise for 1 user or many. I am also not a sql person that has the knowledge to create the querries.
Reply With Quote
  #7 (permalink)  
Old 08-22-2009, 08:36 PM
BES Activated
 
Join Date: Jul 2009
Location: US
Posts: 4
Default

Looks like a great tool, but I've to admin I'm not an expert in sql nor know that much about scripts. Provided that I have access to the $ and my sever name is bes01 and the user is joe doe where in the staments I need to input such furthermore I think the tool will be great if the intented users can have a chance to input the names in a prompt format.
Please let me know if this can be done
Regards,
Al
Reply With Quote
  #8 (permalink)  
Old 09-12-2009, 06:46 PM
BES Administrator
 
Join Date: Mar 2009
Location: Pakistan
Posts: 11
Default A bit explaination required

Dear All,

Im new to it and i really need a clarification as how can i use this script.

I just have to put the BES name and user name wherever required and just run it from the command prompt. Your response is highly appreciated.

And for one bes i just have to use uptil BES 1 or what?

Kindly explain
Reply With Quote
  #9 (permalink)  
Old 09-13-2009, 10:54 PM
hdawg's Avatar
Proprietor
 
Join Date: Nov 2008
Posts: 2,257
Blog Entries: 147
Default

save the txt as search.cmd and run it ...
__________________
http://blog.port3101.org/hdawg/
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Script - Check users with TimeZone records on their devices noname Scripts & Tools / Hints & Tricks 0 11-17-2010 05:01 AM
KB11490 - Out of Coverage Check hdawg Featured BlackBerry KB Articles 1 12-08-2009 01:03 AM
KB12789 - Check the BES account permissions on a BlackBerry smartphone user's mailbox hdawg Featured BlackBerry KB Articles 0 09-02-2009 10:02 PM
KB18779 - "BAS assignments unavailable – BUA test call failed, Check credentials ... hdawg Featured BlackBerry KB Articles 0 08-16-2009 08:59 PM
KB04912 - How to check if and where the CDO.dll file is registered on the BES hdawg Featured BlackBerry KB Articles 0 05-26-2009 10:40 AM


All times are GMT -4. The time now is 01:08 PM.
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.


 

SEO by vBSEO 3.3.2 PL2