Output Format objects provide programmatic access to the output formats supported by Log Parser.
Output Format objects are instantiated with the ProgId and the .NET COM wrapper class names specified in the following table:
Output Format | ProgId | .NET COM Wrapper Class Name |
---|---|---|
CHART | MSUtil.LogQuery.ChartOutputFormat | COMChartOutputContextClassClass |
CSV | MSUtil.LogQuery.CSVOutputFormat | COMCSVOutputContextClassClass |
DATAGRID | MSUtil.LogQuery.DataGridOutputFormat | COMDataGridOutputContextClassClass |
IIS | MSUtil.LogQuery.IISOutputFormat | COMIISOutputContextClassClass |
NAT | MSUtil.LogQuery.NativeOutputFormat | COMNativeOutputContextClassClass |
SQL | MSUtil.LogQuery.SQLOutputFormat | COMSQLOutputContextClassClass |
SYSLOG | MSUtil.LogQuery.SYSLOGOutputFormat | COMSYSLOGOutputContextClassClass |
TPL | MSUtil.LogQuery.TemplateOutputFormat | COMTemplateOutputContextClassClass |
TSV | MSUtil.LogQuery.TSVOutputFormat | COMTSVOutputContextClassClass |
W3C | MSUtil.LogQuery.W3COutputFormat | COMW3COutputContextClassClass |
XML | MSUtil.LogQuery.XMLOutputFormat | COMXMLOutputContextClassClass |
After instantiating an output format object, an application can set the output format parameters and use the object as an argument to the ExecuteBatch method of the LogQuery object.
Parameter values | Property value type | JScript Example |
---|---|---|
"ON"/"OFF" values | Boolean | oCSVOutputFormat.tabs = true; |
Enumeration values (e.g. "ON"/"OFF"/"AUTO") | String | oCSVOutputFormat.oDQuotes = "OFF"; |
String values | String | oCSVOutputFormat.oTsFormat ="yyyy-MM-dd"; |
Numeric values | Number | oCSVOutputFormat.oCodepage = -1; |
JScript example:
var oLogQuery = new ActiveXObject("MSUtil.LogQuery"); // Create EVT Input Format object var oEVTInputFormat = new ActiveXObject("MSUtil.LogQuery.EventLogInputFormat"); // Create CSV Output Format object var oCSVOutputFormat = new ActiveXObject("MSUtil.LogQuery.CSVOutputFormat"); // Set output format parameters oCSVOutputFormat.tabs = true; oCSVOutputFormat.oDQuotes = "OFF"; oCSVOutputFormat.oTsFormat = "yyyy-MM-dd"; oCSVOutputFormat.oCodepage = -1; // Create query text var strQuery = "SELECT TimeGenerated, Message INTO Output.csv FROM System"; // Execute query oLogQuery.ExecuteBatch( strQuery, oEVTInputFormat, oCSVOutputFormat );VBScript example:
Dim oLogQuery Dim oEVTInputFormat Dim oCSVOutputFormat Dim strQuery Dim oRecordSet Set oLogQuery = CreateObject("MSUtil.LogQuery") ' Create EVT Input Format object Set oEVTInputFormat = CreateObject("MSUtil.LogQuery.EventLogInputFormat") ' Create CSV Output Format object Set oCSVOutputFormat = CreateObject("MSUtil.LogQuery.CSVOutputFormat") ' Set output format parameters oCSVOutputFormat.tabs = True oCSVOutputFormat.oDQuotes = "OFF" oCSVOutputFormat.oTsFormat = "yyyy-MM-dd" oCSVOutputFormat.oCodepage = -1 ' Create query text strQuery = "SELECT TimeGenerated, Message INTO Output.csv FROM System" ' Execute query oLogQuery.ExecuteBatch strQuery, oEVTInputFormat, oCSVOutputFormat
© 2004 Microsoft Corporation. All rights reserved.