Finding values that are causing NaN for Mean statistic function in Graylog2 - graylog2

I have a simple request log where each record has an execution time in seconds, under exec_time property. It should always be a number (lower the better). Based on that property I have dashboard widget that shows its Mean value and it was working just fine until recently. Now it shows NaN.
My guess is that there's one or more records with exec_time that's not numeric. How can I find these records?

Take your request logs, and iterate over them with a simple script to check every value individually. Print out the ones that are wrong. With no other information my guess is you have a mis-tagged non-number field feeding into "exec_time", an empty (null, none) value, something too large, something too small, or a corrupted entry somewhere.

Related

VLOOKUP function not returning correct value, Index Match also incorrect. User Error?

Working in Excel 2019. In the same realm as one of my previous questions, I'm working with a database that I'm trying to look through via functions to get my values. The VLOOKUP tool worked well for going through the time-table to find the value I need, but it's not working when I'm trying to find RPM as the look-up value. Here's the gist of the data.
We have Time(sec, A:A in "PPT_156Data" sheet), RPM (B:B in same sheet), and Pressure (Bar, C:C in same sheet).
From the graph, you can see that we ramp to 8000RPM over the course of around 60 seconds, and then ramp down to 0RPM over the next 30. Test times WILL vary and rates WILL vary from pump-to-pump, as each one will give different data values based on the pump. That's why, say, 1000RPM will not be in the same spot every time.
I'm trying to find the RPM at 1000 intervals up to 8000 and report out the pressure at said intervals.
Here's what I tried so far, with imagery as well.
'Disregard if you see W25 for S25, I had just been trying multiple things
First, I attempted the same VLOOKUP code I had done for the time-table prior
=VLOOKUP(S25,PPT156_Data!B:C,2,TRUE) 'S25 being lookup value
This worked fine, UP UNTIL it hit a particular spot. For some reason, as soon as it tries to find an approximate match for 6663RPM, it faults out and gives incorrect data. From then on, all the way to 8000RPM, it will ONLY give the result of 0.139BAR. I have no clue why. Trying to find that value in the return array gives multiple results, but it's not like it's the ONLY value left.
So, I tried to do a wildcard for it with the following code
=VLOOKUP("*"&S25&"*",PPT156_Data!B:C,2,FALSE) 'Attempted both False and True states
Gave N/A for both of the values. Not sure if I'm entering in the wildcard incorrectly here. The decimal places that the RPM can go to ranges between 2-5 (hundredths to hundred-thousandths, IE 7000.00750)
I then thought maybe an Index Match would work.
=INDEX(PPT156_Data!B:C,MATCH(S25,PPT156_Data!B:B,-1),2)
Tried that in wildcard format too, returned nothing. So, I decided to see if I could even match a value for RPM with the following attempts
=MATCH(S25,PPT_Data156!B:B,-1)
This gave nothing. HOWEVER, when setting the match specification to 1, it gives the very last row in the data set. So, I decided to find a value in column B, and attempt to match with it exactly.
=MATCH(7000.07,PPT_Data156!B:B,0)
This also returned nothing. Even though, you can see in my images, that the value is ABSOLUTELY there. SIGFIG shows it's 7000.1 but trust me, it's 7000.07. So that sort of threw me for a loop. Figuring maybe there was a different error and grasping at straws, tried another Index Match formula, this time subtracting the lookup value in an attempt to get it extremely close and absolute value/min it
=INDEX(PPT156_Data!C:C,MATCH(MIN(ABS(PPT156_Data!B:B-S25)),ABS(PPT156_Data!B:B-S25),1))
I'm at a loss. I'm not sure if because the rate ramps up and down, thus not being in ascending order, is causing a problem? I can't change that. I am thinking I may need to create a macro for this in some way? Maybe a helper table? But I can't even FIND the match value to create a helper table. Any help at all would be VERY appreciative.
Thank you for your time looking at my post.
I am presuming that you want the first pressure reading when the RPM hits above each 1000 interval. I got to a solution but feels a bit complex.
=index(C:C,1/max(iferror(1/(row(B:B)*(B:B>E12)),Null)))
Breaking this down, we create a boolean array where the RPM hits above the interval
=B:B>E12
and then we multiple this by the array of the rows of column B
row(B:B)*(B:B>E12)
which gives us an array of the row numbers when the RPM is above E12 but also zero for all the ones that do not.
=iferror(1/(row(B:B)*(B:B>E12)),Null)
We then force an error with the zeros by dividing and replace with null. We get the max since we inverse the row numbers and then inverse again to get the row number back.
=index(C:C,1/max(iferror(1/(row(B:B)*(B:B>E12)),Null)))
[Excel working screenshot][1]
[1]: https://i.stack.imgur.com/uhcaX.png

How to get the index value corresponding to a max value for a specific column

I have a dataset uber_data having columns as [START_DATE* ,END_DATE* CATEGORY* , START* ,STOP* ,MILES* ]where START* is the starting location and STOP* is the ending location. I have to get the most frequent route taken by uber driver.
And below is the code that I m using to get the required.
uber_data[['START*','STOP*','START_DATE*']].groupby(['START*','STOP*']).count().max()
This is getting me the number of routes which comes to be 201. But I could not figure it how to get the combination for which this 201 is coming. I have to manually see through the data to know the combination which comes out to be Agnew-Cary
I want my output in this way
**START* STOP* START_DATE*
Agnew Cary 201**
I tried getting the value using index() but did not get the desired result.
use
uber_data.groupby(['START*','STOP*'])['START_DATE*'].count().sort_values(ascending=False).head(1)
which should give you both the index and value

Firebase limit_to_last(1) doesn't work as expected

I have data in firebase that is recording temperature like the following:
I will eventually have a number of weeks, the key starts at 1, next week the key will be 2 then 3 etc etc
I wanted to write a query that gives me the data from the last week (The week with the highest numbered key)
I have this line of code in a python script:
rtn = root.child('bedroom').child('weeks').order_by_key().limit_to_last(1).get()
print(rtn)
This is what is printed out:
[None, {'date_time': '2018-06-08 19:38:41.634010', 'temperature': '21'}]
Why is None at the start of the array? Do I assume it is always here? I want to use the data in the second location of the array. But if it isn't always in the second location of the array my code will then break. I thought that query would return an array of size 1.
I think when I was testing I did see the array only being 1 element in size with the json structure as the first element but I cannot confirm this.
When you use numeric keys (like you do), Firebase may interpret your data as an array. To learn more about this, read Best Practices: Arrays in Firebase.
If this array coercion is a problem for your app, I recommend prefixing the number with a fixed string, e.g. "week_1" or even better "week_01 (since that may you can filter on ranges of weeks).

Fix the structure of the SSRS Matrix

I have been working on a small project. I am trying to display all the results in the same row without NULL values. I've written a small expression to remove the Null values already "=IIF(IsNothing(Fields!RegisterNo.Value),True,False)". However, the rows seem to be moving one level down as it is displayed in the picture ResultMatrix1. I want the results to be on the same level. Can you please tell me if this is possible and how I can achieve it. Is it something to do with the groupings or something else?
Design Groupings
By default, when you create a table, there is a Row Group called "Details" that is not actually grouped by anything. This causes it to produce one row for each row from the dataset. Since you are trying to group these, you need to make sure that innermost group is grouped by your Staff Ref No.
In the lower-right cell, you may need to change the expression to use a Max function. This will simply avoid arbitrarily showing blanks when they happen to be sorted before a real value within that group.

Xpages: get count of values in multi-value field in view

I have 100 documents with a multi-value field. The field holds 5 possible values (Albert,Ben,Chris,Don,Ed) let's say. The field must contain 1 value, but can contain up to 5.
I need to compute the number of docs that contain each value, so
Albert 56
Ben 22
Chris 79
etc.
This seemed easy. I constructed a view that contains the docs, the first column is the field, and I selected show multiple documents for multiple feeds.
In SSJS loop through my master list of values in the field, and for each one do a getDocumentByKey.
myArray = applicationScope.application;
var dc:NotesDocumentCollection;
for (index = 0; index < myArray.length; ++index) {
dc = view1.getAllDocumentsByKey(myArray[index]);
Print(dc.getCount())
}
This gets the first value correctly, but none after. If I just hard code a particular value, it works. But when I call the getAllDocumentsByKey a second time, it doesn't return the right value.
I think this would work fine in LS, but in SSJS I must clear or recycle or rest something, but I don't know what.
Bryan,
Two things to try in this order:
Your first line of myArray = applicationScope.application; doesn't look right. I suspect that you are not actually getting an array here. I think you are just getting the first value from your applicationScope. Add a print statement on the next line of print(myArray.length); If it is always equal to one, that is your problem. You are not using var and you should set the variable to some java type using a colon.
Before the end of your for loop, try setting your collection to null. dc = null; This way you know for sure that you are getting a new collection in the next iteration.
Are any of your multi-value field values ambiguous? getAllDocumentsByKey(Vector) does partial matches. Unless you ever want that, I would recommend always using the second parameter and setting it to true, same always for getAllEntriesByKey().
An alternative, which will definitely perform better, would be to add a total column to the view. There's a performance hit of that on the view indexing, but you can then use a ViewNavigator with getColumnValues() and getNextSibling(). getCount() is extremely poor performing in LS and will almost certainly be as poorly performing in SSJS/Java. See this blog post from a few years ago http://www.intec.co.uk/why-you-shouldnt-count-on-a-notesviewnavigator/
If I understand that right: you want to count all values that are possible over an amount of documents to have a 5 value list with corresponsing 5 value counts, right?
You could loop through all docs, loop through all values and add entries to a HashMap with the value as key and an int as value (which should be increased everytime). Afterall you have a Map with 5 values holding the sums of each keys.
You will never get the right answer with getAllDocumentsByKey(). When document shows in one category, it will be missing from the collection of next category. That's the way it works.
Use ViewNavigator instead. Build it by category and simply count ViewEntries.

Resources