Content

General description

In order to set a custom TimeGenerated datetime into some ThinkServer events you need to insert pyhton code. The solution is using SendMessageToSmartConsole function inside monitor script.

This article describes how to use the function with separated Date and Time values.

Solution

First of all you have to take into account date and time formats.

Usually, when you are recollecting some events from a log, the monitor receives diferrent kind of datetime formats, like "DD/MM/YYYY HH:MM:SS" or "DD-MM-YYYY HH:MM:SS".

In order to use SendMessageToSmartConsole function you need to work wiht the following format:
"YYYY-MM-DD HH:MM:SS".

Then spliting datetime into date and time you will have:
DateFormatted as "YYYY-MM-DD" and HourFormatted as "HH:MM:SS".

Finally, if you got the format of the values ​​as above, you just have to deploy the function in order to insert records into the events database. The following codes are examples for SWIFT and MEP events:

SendMessageToSmartConsole(SUCCESS,Mensaje,Variables=[RecordFieldValue03, RecordFieldValue15, RecordFieldValue09, RecordFieldValue07, RecordFieldValue11, RecordFieldValue14, RecordFieldValue13, RecordFieldValue08, RecordFieldValue01, RecordFieldValue02, RecordFieldValue12, RecordFieldValue26], EventID=EventoID, SourceName=VSMMonitorName, EventLogType='SWIFT', Category='EventData', DayGenerated=DateFormatted, HourGenerated=HourFormatted)

SendMessageToSmartConsole(SUCCESS, Mensaje, Variables=[Host, DBName, Query, FechaGenerated + ' ' + HoraGenerated, RecordFieldValue02, RecordFieldValue03, RecordFieldValue04, RecordFieldValue05, RecordFieldValue06, RecordFieldValue07, RecordFieldValue08, RecordFieldValue09, RecordFieldValue10, RecordFieldValue11, RecordFieldValue12, RecordFieldValue13, RecordFieldValue14, RecordFieldValue15, RecordFieldValue16, RecordFieldValue17, RecordFieldValue18], EventID=10304, DayGenerated=DateFormatted, HourGenerated=HourFormatted)


Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: October 18, 2018