As an example, Kiwi scripting doesn't seem to support Jscript functions like GetMilliseconds().
What other functions? What are you attempting to do with these functions?
Thanks for the reply bshopp, but I may have jumped the gun and the function might be supported, it did not make sense that some functions would not be supported, but I'm really not fluent in Javascript. The error I received might have also been misleading... "Object Doesn't support this property or method on line: 0" Which was generated after trying to get the millisecond difference between 2 dates, but getting the 2 dates seemed to work. While it doesn't make sense that only "Some" functions are supported, the above error made me think it wasn't supported, but I beleive I am mistaken.
I still have not gotten it to work, but I was able to use the timer() function in VBScript to get what I wanted which was the ability to time scripts, and rules. More importantly, sections of large scripts.
I am no scripting expert, maybe some other folks here on the forum can assist? Anyone?
Steven Klassen might of some assistance? He's one of our new MVPs
Hey , could you post a snippet of the code you're having problems with? It's possible the method is supported but you're trying to access it from the wrong object.
Steve,
Thanks for the reply, but I did figure out what I was doing wrong and it was definitely me. I'm feeling a bit sheepish over it, but I'm not one to figure out the problem and not post it though, so here goes. And if you want to move this out of the "Feature Request" space and into the main Kiwi Syslog space that's probably where it belongs.
I was moving away from VBScript because there isn't a way to break down milliseconds that I was aware of, and so I was using JScript which I am not overly familiar with yet. I was trying to use GetMilliseconds() instead of getMilliseconds() in JScript. That capital G broke it.
I have, however, already moved to code in VBScript that solves my problem. In my first rule, I have this script:
Function Main()
VarGlobal01 = 1000.0 * Timer()
Main = "OK"
End Function.
Then as my last rule a script contains:
VarGlobal02 = VarGlobal01 - (1000.0 * Timer())
This gives me the time in milliseconds that every one of my scripts and rules took to process the last message that was processed. Right now, by the time you look at the globals, they are out of date, but I will resolve that.
I'm using that same concept in some of my larger scripts now that it works so I can see how long individual sections are taking as I add new data analysis to my scripts. I will eventually change the global variabls to dictionary items for the first/last rule and calculate the min/max and average processing times on the fly and store those as globals instead.
The original problem was a script that took longer than the default allowed script timeout value which was 10 seconds. While some might have been able to look at the script and spot right away which section was taking the longest, I was timing them and only a few sections took longer than a second to process, the rest of the script sections specified 0 seconds because nothing was counting milliseconds. The entire script still took more than 10 seconds, but that knowledge was not helping me fine tune it.
For instance if I was checking the processing speed of 15 different functions in a script and they are all taking 0.859 seconds, I would get all 0's from the timing functions, but it's still taking over 12 seconds to run and timing out before it finishes processing that message.
Using the Timer() function in VB will result in a value that has an accuracy of within about ~ 16 - 20 milliseconds which is accurate enough for my purposes.
Right on, glad you sorted it out. already moved the thread to the general Kiwi area so I could respond.