Using Logparser.exe with .etl files - Cannot retrieve high resolution timestamp - logparser

I'm using logparser.exe (http://www.microsoft.com/en-us/download/details.aspx?id=24659) to process a captured trace (in a .etl file). The output however is not proving the high resolution timestamp that I know is recorded in the .etl file.
The output is spitting out timestamps only up to the seconds (i.e. 2014-07-24 18:52:39)

Answered my own question:
Logparser.exe by default formats the timestamps to exclude the milliseconds / nanoseconds. You have two options to view a higher resolution timestamp:
1. Verbosely convert your specific fields using TO_STRING(Timestamp, 'HH:mm:ss.ln'). An example useage is below:
c:>"c:\Program Files (x86)\Log Parser 2.2\LogParser.exe" -i:ETW -o:CSV "SELECT TO_STRING(Timestamp, 'HH:mm:ss.ln') AS Timestamp,
EventTypeName FROM 'c:\PerfLogs\ASP\LocalSystem\20140724-000003\Verbose Trace.etl'" > verbose.csv
2. Change all timestamp output regardless of which field using the -oTsFormat argument:
c:>"c:\Program Files (x86)\Log Parser 2.2\LogParser.exe" -i:ETW -o:CSV -oTsFormat "HH:mm:
ss.ln" "SELECT * FROM 'c:\PerfLogs\ASP\LocalSystem\20140724-000003\Verbose Trace.etl'" > verbose.csv
Time Format Strings:
More time format strings are listed here: http://strivinglife.com/words/post/Microsoft-Log-Parser-timestamp-formats
HH - Hour
mm - Minute
ss - seconds
l - milliseconds
n - nanoseconds

Related

What is the result of setting the 'creationTime' metadata field of a transaction?

The pact-lang-api library accepts metadata for transactions that it formats to be sent off to a node. One of the metadata fields is creationTime. The closest description of this field I can find is in the YAML section of the Pact docs, which states this metadata field denotes:
optional integer tx execution time after offset
In the pact-lang-api code I've seen in the wild this value is usually set to the current time or a delayed time (for example, in the deploy-contract section of the pact-lang-api cookbook):
Math.round(new Date().getTime() / 1000) - 15
This indicates the current time in seconds from the Unix epoch, minus 15 seconds. In other words, the "optional integer tx execution time after offset" is fifteen seconds before this transaction is sent to a node.
What does this mean? Specifically, I'm trying to understand what the effect of setting this metadata field is, and what might happen if I set it to different values (what if I set it to 15 seconds after the transaction was constructed, instead of 15 seconds before the transaction as the cookbook does?).

Show second to last item in Influx query (or ignore last)

I am using Grafana to show the number of entries added to the database every minute, and I would like to display the last recent fully counted value.
If I give the following command:
SELECT count("value") FROM "numSv" GROUP BY time(1m)
1615904700000000000 60
1615904760000000000 60
1615904820000000000 60
1615904880000000000 60
1615904940000000000 36
Grafana is going to display the last entry, which is still in the process of counting. How can I display the n[-1] entry, which has been fully counted?
Otherwise, how do I ask Influx to give me the same results excluding the last dataset?
P.S.: Using WHERE time > now() - 60s, etc... doesn't work.
Use "magic" Grafana time range math and select dashboard time range from now-1m/m to now-1m/m. That generates an absolute time range, which refers to last fully counted minute. Query is then standard with $timeFilter Grafana macro:
SELECT count("value") FROM "numSv" WHERE $timeFilter

DB2/IDAA: How to properly format VARCHAR to TIMESTAMP with milliseconds

I am using IDAA for DB2. At one point I use TO_DATE to convert some dates and it works:
TO_DATE('09/03/2018 06:49:23','MM/DD/YYYY HH:MI:SS')
But when I have a VARCHAR value with milliseconds in the timestamp, TO_DATE returns an error. I looked around online and found an answer that says to use TO_TIMESTAMP but that doesn't work:
TO_TIMESTAMP('09/03/2018 06:49:23.443000','MM/DD/YYYY HH:MI:SS.NNNNNN')
I've looked at every answer on here and tried many variations. I've tried every combination of the functions TO_TIMESTAMP, TO_DATE, TIMESTAMP_FORMAT and the format for milliseconds as FF, FF6, NNNNNN. I get these errors:
NO AUTHORIZED FUNCTION NAMED TO_TIMESTAMP HAVING COMPATIBLE ARGUMENTS WAS FOUND. SQLCODE=-440
SQL error: SQLCODE = -904, SQLSTATE = 57011, SQLERRMC = Invalid Date.. SQLCODE=-904
Maybe it's different for the IDAA? I don't know.
I'm running DB2 for z/OS V11 using IBM Data Studio 4.1.3.
TIMESTAMP_FORMAT for Db2 for z/OS is documented here
https://www.ibm.com/support/knowledgecenter/en/SSEPEK_12.0.0/sqlref/src/tpc/db2z_bif_timestampformat.html
Do note that HH is the same as HH12, not HH24, so it might be that you need, e.g.
$ db2 "values TIMESTAMP_FORMAT('09/03/2018 16:49:23','MM/DD/YYYY HH24:MI:SS')"
1
--------------------------
2018-09-03-16.49.23.000000
1 record(s) selected.
( The above is from Db2 LUW, but I would assume that function works the same on Db2 for z/OS/ and DAA )
Based on the following link -
https://www.ibm.com/support/knowledgecenter/en/SS4LQ8_4.1.0/com.ibm.datatools.aqt.doc/gui/concepts/c_idaa_inconsistencies.html
IBM Db2 Analytics Accelerator for z/OS does not support all date and time formats that Db2 supports. This might lead to different results for accelerated and inhouse Db2 queries if the VARCHAR_FORMAT or TIMESTAMP_FORMAT scalar function is used. The following formats are not supported by IBM Db2 Analytics Accelerator for z/OS:
FF[n] - fractional seconds (000000-999999)
The optional number n is used to specify the number of digits to include in the return value. Valid values for n are the integers from 1-6. The default is 6.
ID - ISO day of the week (1-7)
The value 1 represents Monday. The value 7 represents Sunday.
IYYY - ISO year (0000-9999)
The last four digits of the year based on the ISO week that is returned.
NNNNNN - microseconds (000000-999999)
This format is equivalent to FF6.
RR - last two digits of the year (00-99)
SSSSS - seconds since the previous midnight

How to Get time from CSV data?

i have downloaded a csv file from my database.
in date field i found
1416551169
1417798664
1415727808
etc as times
please can anyone please tell how to extract time and date from it like 01:04:2014 10:30 PM
Thank you
That is a Unix timestamp. You can convert from the Unix time stamp to Excel with the following Excel formula (assuming Unix Time Stamp is in A1)
=A1/(60*60*24)+"1/1/1970"
The numbers you downloaded like like timestamps, probably representing the number of seconds after a particular point in time. Depending on what programming resources you have available, you should have a function to convert the raw timestamp into a person-readable date.

Realstudio (2011 4.2) Date in Milliseconds

In my project I communicate with a Microsoft SQL-Database where I have a column with DATETIMEs. The date-information in the database is with Milliseconds, that's very important, like 2012-03-03 12:00:00.364
In Java, for example, it's no problem to read the Date value from the RecordSet with Milliseconds.
In Realbasic when I do something like that time = rs.IdxField(i).DateValue the milliseconds are lost, because the Date-Object has a maximum resolution of seconds.
How can I read the SQL-Datetime with milliseconds? What can be an easy way to read it as String and then parse it or something like that?
If you already have the information in a database and are just reading from your SQL database, I'd recommend subclassing Date, adding a variable for Milliseconds, and then just manually parsing out from the period/etc to get the milliseconds value.
dim d as new DateWithMilliseconds
d=rs.IdxField(i).DateValue
////and then however you'd parse out the milliseconds based on the string format
d.milliseconds=NthField(rs.idxField(i).stringvalue,".",2)
You could then add other functions for comparing the date subclass to include the milliseconds variable.
Use Convert Statement
Syntax:
select CONVERT(nvarchar(30), GETDATE(), 126)
try it.
Tiz

Resources