




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
使用微軟工具來進行
IIS6.0除錯與資料探勘胡士亮平台架構技術經理台灣微軟開發工具暨平台推廣處內容大綱甚麼是LogParser開始使用
LogParserLogParser2.2版新功能LogParser進階使用情境網站應用程式除錯基礎除錯工具介紹
DebugDiagnostics1.0功能介紹常見的網站應用程式除錯情境LogParserBasics
KeyConceptsLogParserrequires…InputFormat
[+options]QueryOutputFormat[+options][+options]QueryLanguage:SupportsmostofthetrueSQLlanguagesyntaxExtendsthelanguagewithadditionalfunctionsDemonstration1
FirstWalk-Through
LogParserCommand-LineHelp
SimpleQuery
UsingInput/OutputParameters
LogParserBasics
FunctionsTogetalistoffunctions[2.1]
logparser–h2[2.2]
logparser–hFUNCTIONSExamples:ConversionFunctionsTO_TIMESTAMPTO_LOCALTIMETO_INTStringHandlingSTRLENSUBSTRSTRCATOtherREVERSEDNSQUANTIZEEXTRACT_EXTENSION[2.2]CASE[2.2]LogParserBasics
FunctionExampleConvertlogfiletimestampfromUTCtimetolocaltime:SELECT TO_DATE(TO_LOCALTIME(TO_TIMESTAMP(date,time)))ASdate, TO_TIME(TO_LOCALTIME(TO_TIMESTAMP(date,time)))AStime, c-ip, cs-username, s-ip, s-port, cs-method, cs-uri-stem, cs-uri-query, sc-status, sc-win32-status, sc-bytes, cs-bytes, time-taken, cs(User-Agent)FROMC:\WINDOWS\system32\Logfiles\W3SVC1\ex040308.logDemonstration2
Functions
ConvertLogFileTimefrom
UTCTimetoLocalTime
ExamineTimeTakenPerVDir
LogParserBasics
OutputTemplateslogparser-h-o:TPLConsistsof:HeaderBodyFooterBestforreport-styleresults<HTML><HEAD><TITLE>Hits/HourforLedburyHomePage</TITLE></HEAD><BODYBGCOLOR="#EFEFFF"><TABLEBORDER="1"CELLPADDING="2“CELLSPACING="2"><TR><THCOLSPAN="2"ALIGN="CENTER">Hits/HourforLedburyHomePage</TH></TR><TR><THALIGN="LEFT">Hour</TH><THALIGN="LEFT">#Hits</TH></TR><TR><TD>2004-03-0722:00:00</TD><TD>1</TD></TR><TR><TD>2004-03-0909:00:00</TD><TD>2</TD></TR><TR><TD>2004-03-1018:00:00</TD><TD>2</TD></TR></TABLE></BODY></HTML>HEADERBODYFOOTERTEMPLATEOUTPUTDemonstration3
Templates
BrokenLinksReport
EventLogMessages
LogParserBasics
ImportingDataintoSQLServerNote:Fieldnamesinqueryoutputarenotimportant--thefieldpositiondetermineswhatcolumnthedataisinsertedintointheSQLtableSELECT 1, TO_TIMESTAMP(date,time)ASLogTimeStamp, s-ip, cs-method, cs-uri-stem, cs-uri-query, s-port, cs-username, c-ip, cs(User-Agent), sc-status, sc-substatus, sc-win32-statusINTOW3SVC2FROMex040309.logallowsforanauto-generatedidentitycolumninSQLdatabasetableLogParserBasics
HowdoIgetstarted?Findthecolumnnamesinyourdatasource:LogParser–h–i:<IISW3C|IIS|EVT>or…“SELECT*FROM<datasource>”ForTSVorCSVfiles:LogParser–h–i:CSV/TSV<filename>UnderstanddataprovidedinthecolumnsApplyanyfunctionsnecessarytoconvertthatdataintoausefulform[2.2]–queryinfoOptionBuildingonLogParser
LogParserCOMArchitectureMSUtil.LogQueryInputandOutputFormatobjectsMSUtil.LogQuery.IISW3CInputFormatMSUtil.LogQuery.EventLogInputFormatMSUtil.LogQuery.SQLOutputFormatMSUtil.LogQuery.CSVOutputFormatTwowaystorunquery:MSUtil.LogQuery.ExecuteReturnsaLogRecordSetobjectthatallowsthescripttoiteratethroughthequeryresultsMSUtil.LogQuery.ExecuteBatchRunsaquerywithapre-specifiedoutputtarget(e.g.SQLorCSV)BuildingonLogParser
Input/OutputFormatParametersLogParser2.1and2.0Parametersdonotalwayshavesamenameforcommand-lineversionandCOMversion;forexample:logparserfile:query.sql–o:NAT–rtp:-1NativeOutputFormat.rowsToPrint/InstantKB/article.aspx?id=10039
LogParser2.2ParametershavesamenameforbothcommandlinetoolandCOMinterfaceBuildingonLogParser
VBScriptCreateLogQueryobjectandinput/outputformatobjectsDIMobjLogQuery:SETobjLogQuery=WScript.CreateObject("MSUtil.LogQuery")'GettheIISInputandW3CoutputformatsDIMw3cInputFormat:SETw3cInputFormat= WScript.CreateObject("MSUtil.LogQuery.IISW3CInputFormat")DIMw3cOutputFormat:SETw3cOutputFormat= WScript.CreateObject("MSUtil.LogQuery.W3COutputFormat")w3cOutputFormat.filemode=0'CreateaSQLqueryquery="SELECTTOP20cs-uri-stem,COUNT(*)asTotal"&_"INTOresults.logFROMC:\WINDOWS\system32\Logfiles\W3SVC1\ex*.log"&_"GROUPBYcs-uri-stemORDERBYTotalDESC"objLogQuery.ExecuteBatchquery,w3cInputFormat,w3cOutputFormatForanexamplethatusesExecuteandLogRecordSet,see\Samples\Scripts\ErrorCodes.jsinLogParserinstallationdirectory.ThisisalsoavailableonTechNet:/technet/community/scriptcenter/logs/logparser/scripts/logpar01.mspx.BuildingonLogParser
C#InteropUsesSystem.ReflectionandSystem.ActivatorTypecomLogQueryType=Type.GetTypeFromProgID("MSUtil.LogQuery",true);objectcomLogQueryObject=Activator.CreateInstance(comLogQueryType);//GettheIISInputandW3CoutputformatsTypeinputFormatType=Type.GetTypeFromProgID("MSUtil.LogQuery.IISW3CInputFormat",true);objectinputFormatObject=Activator.CreateInstance(inputFormatType);TypeoutputFormatType=Type.GetTypeFromProgID("MSUtil.LogQuery.W3COutputFormat",true);objectoutputFormatObject=Activator.CreateInstance(outputFormatType);//CreateaSQLquerystringquery="SELECTTOP20cs-uri-stem,COUNT(*)asTotal";query+="INTOresults.logFROMC:\\WINDOWS\\system32\\Logfiles\\W3SVC1\\ex*.log";query+="GROUPBYcs-uri-stemORDERBYTotalDESC";//InvoketheExcuteBatchmethodobject[]inputArgs={query,inputFormatObject,outputFormatObject};comLogQueryType.InvokeMember("ExecuteBatch",BindingFlags.InvokeMethod,null,comLogQueryObject,inputArgs);LogParser2.2Preview
Whatyouwanttoknow…Releases:BetaVersion=>TechNetSubscribersonly,April2004FinalVersion=>Summer2004What'snewinLogParser2.2?…thisandmore…NewInputFormatsETW–EventTracingforWindows®logfilesandlivesessionsTSV–TabandSpaceseparatedvaluetextfilesADS–ReadsinformationfromActiveDirectoryobjectsREG–ReadsinformationfromtheRegistryNETMON–ParsesNETMONcapturesCOM–Pluginuser-implementedcustomInputFormatsLogParser2.2Preview
Whatyouwanttoknow…(2)What'snewinLogParser2.2?…thisandmore…NewOutputFormatsCHART–Createscharts(requiresMicrosoft®OfficeXPorbetter)SYSLOG–SendsinformationtoaSYSLOGserverortoaSYSLOG-formattedtextfileTSV–WritestoaTaborSpaceseparatedvaluefileImprovementstoSQLEngineAddedSQLoperators-BETWEEN,CASE,"WITHROLLUP"inGROUPBYNewFunctions–MOD,EXTRACT_EXTENSION…andmanymorePerformanceImprovementstoexistingInput/OutputFormatsBugFixesLogParser2.2Preview
-queryinfoC:\DemoScripts>logparserfile:SQLDB_Insert.sql-queryinfoWARNING:Outputformatnotspecified-usingNAToutputformat.Query:SELECT1,TO_TIMESTAMP(date,time)ASLogTimeStamp,[s-ip],[cs-method],[cs-uri-stem],[cs-uri-query],[s-port],[cs-username],[c-ip],[cs(User-Agent)],[sc-status],[sc-substatus],[sc-win32-status],[sc-bytes],[cs-bytes],[time-taken]INTOW3SVC2FROMex040309.logFormatsselected:InputFormat:IISW3C(IISW3CExtendedLogFormat)OutputFormat:NAT(NativeFormat)Queryfields:1(I)LogTimeStamp(T)s-ip(S)cs-method(S)cs-uri-stem(S)cs-uri-query(S)s-port(I)cs-username(S)c-ip(S)cs(User-Agent)(S)sc-status(I)sc-substatus(I)sc-win32-status(I)sc-bytes(I)cs-bytes(I)time-taken(I)LogParser2.2Preview
ChartOutputFormatUsesMicrosoftOfficeWebComponentsChartSpaceObjectModelSeethislinkforobjectmodel:/library/default.asp?url=/library/en-us/owcvba10/html/octocMSOWCObjectModels.asp
Youwillneed:LicensedversionofMicrosoftOfficeWebComponents,availableinMicrosoftOfficeXPorbetterUseExceltoviewdifferentCHARTtypes:InsertMenu,Chartoption–showsthedifferentcharttypesDemonstration4
LogParser2.2Preview
Charts
HitsPerHour–RadialChart
StatusCodeBreakdown–PieChart
LogParser2.2Preview
CheckPoint–incrementalparsingParseonlywhathasnotbeenparsedbefore:ex*.log …fromalllogfilesinadirectory<1> …fromalllogfilesforsite1System …fromtheSystemEventLogRequiresaCheckPointfiletostorestate:logparser"SELECTTimeGenerated,EventTypeName,StringsFROMSystemWHERESourceName='W3SVC'"-icheckpointevent.lpcDemonstration5
CheckPoint
EventLogUpdateE-mail
SessionSummary
LogParserhasasmanyapplications
asyoucanimagine…
FlexibleandpowerfulAswithalldatamining,theapplicationstartswithaquestion…BuildingBlocksforAuditingandMonitoringLogParsercanparsealmostanydatasourceonyourserver…withtheadditionalinputandoutputformatsinLogParser2.2,there’sreallynothingmoreyouneedtobuildcustomauditingandmonitoringforyoursystemAnyText,AnyTimeLogParsercanreadmostlogfiles,textdocuments,andSTDOUT/textstreams,andgenerateresultsinaHUGEnumberofformatstomakethemusefulandintelligible議程大綱簡介CrashHangsMemoryleaksDebugdiagnostics延展性總結Web應用程式除錯簡介除錯歷史的過去與現在簡介整合工具來解決偵錯情境影響除錯的變數簡介過去:提供許多工具但很少解決方案過去的工具通常不是設計給伺服器端使用沒有一個完整涵蓋所有除錯需求的工具需要除錯的專業知識才能使用工具現在:更多進階的除錯工具但是仍然要花費許多時間來解決問題仍然缺乏分析工具現存工具並沒有整合成為完整的除錯工具這是不是您遇過的惡夢?談到除錯工具…現在有三種設計來解決相同問題的工具Dr.WatsonsAutoDumpPlusIISCrash/HangAgent當WindowsServer版本更新,除錯工具也隨之改版除錯工具的範例影響除錯的變數IIS是一個“應用程式平台”非常容易進行延展的平台功能延展方式包括Proxy伺服器、網頁上傳/發布元件、RequestHandler以及其他更多延展功能可延展的平台是非常良好的但是可能很難找出問題所在除錯對任何平台來說都是最糟狀況影響除錯的變數IIS的延展能力ISAPIMicrosoftASP.NETActiveServerPages(ASP)COM元件資料層驅動程式,例如Oracle與MDAC等這些“延展能力”元件常常整合並執行在相同的程序中Crash情境Crash的背景介紹定義並展示workerprocesscrashes:
與如何除錯crash使用DebugDiag來快速找出Crash的根本原因AccessViolation:C0000005BreakpointException:80000003StackOverflow:C00000FDC++exception:E06D7363Managedexception:E0434F4DInvalidHandle:C0000008背景介紹:Exceptions什麼是exception?應用程式如何導致exceptions?什麼是“已處理”的exception?未處理的exceptions需要除錯與解決背景介紹:Heap什麼是heap?Heap一個資料結構Heap毀損:使用heap時必須遵守相關規則當違反規則時就會發生heap毀損Heap毀損 crashes毀損heap的程式通常不是受到影響的程式現今除錯Crashes工具Crash症狀通常包括可在事件檢視器中看到的事件如果啟用Dr.Watson,crashes通常會建立memory.dmpMemory.dmp是crash程序的快照,可以用來進行事後分析Hang情境“Processhangs”的理論現在如何除錯hang使用DebugDiag來除錯“processhangs”“ProcessHangs”的理論什麼是process?什麼是thread?程式碼執行的記憶體界線透過呼叫CreateProcess或CreateProcessAsUserAPI由作業系統來配置Processes不執行程式碼包含至少一個thread在Process中獨立的指令執行序列“ProcessHangs”的理論Thread對應用程式造成的影響同步執行能力(虛擬)與Thread數量有關真正的同步執行能力與執行單位數量有關1processor=一個或多個執行單位常見的IISthreadpoolsATQthreadpoolASPthreadpoolASP.NETthreadpool“ProcessHangs”的理論當實作自訂threadpools時建議使用ISAPI延伸ATQthreadpool是敏感且高執行效率的如在ATQThread中執行長時間作業會導致會嚴重的影響IIS效能ISAPIs通常執行時間較長,通常使用自訂的threadpool來分散ATQThread的工作量失控的Threads失控的thread是指陷入無窮迴圈的thread執行消耗大量CPU的工作可能是設計要求或是邏輯錯誤失控的thread會讓其他thread無法使用CPU資源通常受到影響的是正常的threads造成伺服器的效能降低Thread1Thread2Thread3Thread4什麼是BlockedThread沒有使用任何CPU資源的thread等待資料庫呼叫傳回等待WebService呼叫傳回等待Socket/網路呼叫傳回等待被鎖定的資源Locks與Deadlocks什麼是lock?一個同步機制來保護資源不會因為多個threads同時存取而導致資料毀損為什麼開發人員要使用locks?保護資料保護其他不在記憶體內的資源不良的使用locks將影響應用程式造成blockedthreads使用多重locks在應用程式中可能會造成deadlock當沒有thread可用時會造成Processhangs什麼是Leaks…什麼是leak?Leaks種類Leak情境為什麼找出與解決leaks是非常困難?伺服器應用程式常常會將記憶體配置存入Cache應用程式通常是長期執行這些應用程式對外人來說看起來就像是記憶體leaks還有許多其他應用程式快取使用效能監視器靠到記憶體使用不斷成長並不等於是記憶體leak這也不是記憶體leaksLeak情境什麼是短期的記憶體配置?使用大量記憶體的應用程式會造成暫時的記憶體使用尖峰但會在使用後釋放(不會長時間佔用)Leak情境快取與memoryleaks的差異?Memoryleaks是由於不斷的取用記憶體所導致快取記憶體使用情況通常是快速成長,但在應用程式穩定後就不在增加DebugDiag的延展性延展性介紹DebugDiag架構與物件模型DebugDiag中的S
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年学历类自考儿科护理学(一)-中国行政史参考题库含答案解析(5卷)
- 2025年学历类自考中国现代文学史-学前儿童音乐教育参考题库含答案解析(5卷)
- 2025年学历类自考中国当代文学作品选-机关管理参考题库含答案解析(5卷)
- 托管房租赁合同(标准版)
- 2025年学历类自考中国对外贸易-经济法概论参考题库含答案解析(5卷)
- 2025年学历类自考中国对外贸易-学前教育史参考题库含答案解析(5卷)
- 2025年学历类自考中国古代文学史(二)-幼儿园课程参考题库含答案解析(5卷)
- 教师招聘之《小学教师招聘》通关模拟题库及参考答案详解(培优)
- 2025-2030中国天然铀市场经营创新及发展趋势研究报告
- 2025年学历类自考中国古代文学作品选(二)-学前儿童保育学参考题库含答案解析(5卷)
- 数控铣工(四级)职业技能理论知识考试题库附答案(新版)
- 儿童常见疾病的防治 OK课件
- 软件工程导论课件(第六版)(张海潘编著)(1-13章)
- 中建硅墨烯保温板外墙保温施工方案
- 第三讲 神话学
- 山东大学核心期刊目录(文科)
- 中医基础理论-脏象学说
- ICU患者的早期活动
- GB/T 8566-2007信息技术软件生存周期过程
- GB/T 13452.2-2008色漆和清漆漆膜厚度的测定
- GB/T 12730-2008一般传动用窄V带
评论
0/150
提交评论