› Clovertech Forums › Cloverleaf › Error DB search at command line
Is there any way to access the metadata like the new error DB tool does? Such as the protocol driver?
What version are you on?
Rick,
I am not sure I understand your question. Do you want to access the msgDriverControl Metadata at a UPoC or inside an Xlate? If so, then the msgmetaget or xpmmetaget commands for the key DRIVERCTL should do the trick:
set stuff [msgmetaget $msgId DRIVERCTL] or set stuff [xpmmetaget $xlateId DRIVERCTL]
You can retrieve any valid metadata key. If you are not sure of what keys are available, then you can omit the key (DRIVERCTL above) and that will provide a list of metadata keys.
You could do something like this to get all of those values:
set junk [msgmetaget -all $msgId]
foreach metakey $junk {echo “$metakey = [msgmetaget $msgId$metakey]”}
CLASS = engine
DATAFMT =
DBTABLE =
DESTCONN =
DRIVERCTL =
FLAGS = icl_owns_data
ISSTATICDIRTY = 0
ISVARDIRTY = 0
MID = {DOMAIN 0} {HUB 0} {NUM 1}
MSGHOSTID = DESKTOP-2GCNO0B
MSGTENANTID =
ORIGDESTCONN =
ORIGSOURCECONN =
PRIORITY = 5120
RETRIES = 0
SKIPXLT = 0
GROUPID = 0
GROUPMID = {DOMAIN {}} {HUB {}} {NUM {}}
SEPCHARS =
SOURCECONN =
SOURCEMID = {DOMAIN {}} {HUB {}} {NUM {}}
SOURCEMSIIDX = -1
STATE = 0
TIMEIN = {SEC 1713393820} {USEC 795000}
TIMEOUT = {SEC 1713393820} {USEC 795000}
TIMEQCUR = {SEC 0} {USEC 0}
TIMEQTOT = {SEC 0} {USEC 0}
TIMEXLT = {SEC 1713393820} {USEC 795000}
TYPE = data
USERDATA =
USERECOVERDB = 1
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
We are on version 2022. I Was looking to do a proc from an alert and have it look at the protocol driver control where the information I will need to grep resides. The new DB search can do this from the GUI. I think it would be similar to the original DB commands.
Is it the message metadata Driver Control field you want? For that you would need a message ID and I don’t think there is any message ID available when any of the Alert Types are triggered – or is there something I am missing here?
I suspect the Error DB Gui has a message that errored and thus the metadata associated with that message.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Was looking to set an alert to fire and run a script on the db not based on the alert itself but run a report on the db as a whole. The script would look at different pieces of the meta data to obtain the desired information.
Let’s see if I understand this…
Please let me know where I have that wrong above. If you would like to take this discussion off-line email me.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Yes Jim you have it correct.
Well Message Metadata is created by the engine when it receives a message or when you create a message.
Since you will be retrieving DB information NOT using the engine (assuming that is the case), I don’t see how you can get metadata (at least the metadata we are used to in Cloverleaf).
For example, if you are using SQLite commands inside your Tcl proc, there is no Driver Control associated with that.
Again, if you would like to brainstorm off-line, I am willing to participate.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Hey Jim,
Any idea would help, and yes I would welcome any brainstorming.
Email me.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
I believe the error log is a sqlite db exec/databases/elog.elogdb.
[hci@dc1vtclover01 data]$ sqlite3 elog.elogdb
SQLCipher version 3.15.2 2016-11-28 19:13:37
Enter “.help” for instructions
Enter SQL statements terminated with a “;”
sqlite> .schema
CREATE TABLE elog_info (“Version” INTEGER, “ECD” VARCHAR);
CREATE TABLE elog_msgs(
“MessageContent” BLOB,
“DataLen” INTEGER,
“DestConn” VARCHAR,
“OrigDestConn” VARCHAR,
“DataFmt” VARCHAR,
“SepChars” VARCHAR,
“DriverCtl” VARCHAR,
“UserData” VARCHAR,
“MidDomain” INTEGER,
“MidHub” INTEGER,
“MidNum” INTEGER,
“SrcMidDomain” INTEGER,
“SrcMidHub” INTEGER,
“SrcMidNum” INTEGER,
“Type” INTEGER,
“SourceConn” VARCHAR,
“OrigSourceConn” VARCHAR,
“Priority” INTEGER,
“Class” INTEGER,
“Flags” INTEGER,
“EdbState” INTEGER,
“GroupMidDomain” INTEGER,
“GroupMidHub” INTEGER,
“GroupMidNum” INTEGER,
“XltThread” VARCHAR,
“OwnerThread” VARCHAR,
“Retries” INTEGER,
“MidsAreNull” INTEGER,
“SkipXlt” INTEGER,
“GroupID” INTEGER,
“TimeIn” INTEGER,
“TimeXlt” INTEGER,
“TimeOut” INTEGER,
“TimeQCur” INTEGER,
“TimeQTot” INTEGER,
“TimeRec” INTEGER,
“ErrorString” VARCHAR,
“RdbState” INTEGER,
primary key (MidNum,MidHub,MidDomain));
sqlite>
Is this what you are looking for? My guess is that you can access in a similar way to SMATDB files and access the metadata.
Keith,
I think Rick would like to fire an Alert not at all related to a specific message or even the DB in question, then wants to collect information from the DB including Metadata.
If that is the case, I suspect there won’t be a representative message in the Elog (or Error DB).
Do I have what you want correctly described Rick?
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
What I would like to do is look at different pieces of metadata such “DriverCtl” and “OrigSourceConn”. The query would return distinct values. I have done sqlite queries before but not with an encrypted db. I know this is most likely possible but not sure how.
On another note, I was trying to access a smat file, not the error db in this case.
In the documentation, I found the Smat API. Does anyone have an example where the call is in a standalone TCL proc? I keep getting an error that the directory or file does not exist.
And in the example below I used -e ASCII in place of user_defined to open my file. I used this since that is what is in my netconfig. Is this the correct usage?
set smatdbTest [smatdbopen test.smatdb user_defined]
Rick,
Not sure where you are on this but are you basically trying to run a program to look at the Error DB entries on a schedule?
If that is yes, it is possible to do. We have a Shell script and TCL that run out of CRON (I’m old school) that look at every Error DB ( elog.elogdb ) on each one of our CL systems.
This is the select command that we use in our TCL
set sqlcmd “SELECT SourceConn, MidNum, EdbState, ErrorString, UserData, MessageContent, TimeOut FROM elog_msgs where datetime(TimeOut/1000, ‘unixepoch’) >= datetime(‘$timeStart’, ‘unixepoch’);”
Rob