How to filter out some values of grafana dashboard variable? - grafana

I have such a variable but it returns some values which I don't want to see(template0 and template1)
How can I filter them out ?
I tried to write label_values(datname!~"template.*|postgres")
But grafana says that this definition has broken syntax

try to improve the query as follows
label_values({datname=~".+", datname!~"template.*|postgres"}, datname)
Hope this helps!

This works(filter both: postgres and tempate database):

Related

Fill Grafana Dashboard Variable From LoqQL

I have a Grafana dashboard and I'd like to define a variable for this dashboard. I'd like the values of this variable will come from LogQL query. To be more specific - in each log I have a field called "site_ids", and I want the values of the variable to be all the different "site_ids" (longs).
So I wrote this query:
{_namespace_="namespace",_schema_="schema"} | logfmt | line_format "{{.site_ids}}"
Which seems to work when I just run it in the query executor, this is the output (the actual site_ids):
0
-1
196
2
3
...
But when putting it as a query when I try to configure a new variable, I see nothing in the Preview of values:
Unfortunately I can barely find documentation about this..
Any suggestions?
Thanks!
Use label_values like this Query Variable section

Using regex to only return some of the Loki Label values

I am setting a Variable in Grafana.
I want to create a Query, that only returns a subset of the labels with value app the ones I want to return are those ending in dev
My Query so far, returns all of the labels with value app successfully. However, I have been unable to successfully filter the values so that only a-dev b-dev and c-dev are returned.
How do I successfully apply regex (or alternative) to this query so that I can see the desired values?
Any help on this would be greatly appreciated!
I eventually figured out what I needed to do. Originally I was trying to use | to run regex on the results from label_values.
However, this format worked:
label_values({app=~".*-dev$"}, app)
and returned only a-dev b-dev c-dev as expected.

prometheus doesn't match regex query

I'm trying to write a prometheus query in grafana that will select visits_total{route!~"/api/docs/*"}
What I'm trying to say is that it should select all the instances where the route doesn't match /api/docs/* (regex) but this isn't working. It's actually just selecting all the instances. I tried to force it to select others by doing this:
visits_total{route=~"/api/order/*"} but it doesn't return anything. I found these operators in the querying basics page of prometheus. What am I doing wrong here?
May be because you have / in the regex. Try with something like visits_total{route=~".*order.*"} and see if the result is generated or not.
Try this also,
visits_total{route!~"\/api\/docs\/\*"}
If you want to exclude all the things that has the word docs you can use below,
visits_total{route!~".*docs.*"}
The main problem with your original query is that /api/docs/* will only match things like /api/docs and /api/docs//////; i.e. the * in your query will match 0 or more / characters.
I think what you meant to use was /api/docs/.*.

How to use distinct in MongoVue?

I need to find out distinct values(for example : CreationDate or SourceSystem) in MongoDB using MongoVUE. FYI, I can only use the trial version of the same.
I don't think you can do that using MongoVUE. You can do it through MongoDB shell running a command like this:
db.[Collection Name].distinct({Property Name})
ex: db.students.distinct('age')
db.students.distinct('age').length; // gives you the record count
I usually find SQL to Mongo Mapping Chart page useful in these case ( http://www.mongodb.org/display/DOCS/SQL+to+Mongo+Mapping+Chart )
From having a quick look, I can't see how you can either, as the "Find" feature forces you to use:
db.[collectionName].find({...})
so doesn't allow you to do:
db.[collectionName].distinct({...})
I recommend using the normal command line executable for Mongo instead of MongoVUE, then you can use the commands from the 10Gen documentation:
http://www.mongodb.org/display/DOCS/Aggregation#Aggregation-Distinct

Facing issue when search using Zend_Lucene

I am using zend_lucene for search functionality.I 've the following code,
$doc->addField(Zend_Search_Lucene_Field::Text('categoryName', $result->name));
Here name in "$result->name" is varchar type in Database. Also have some following values like dinesh,kumar123,3333. For testing purpose i have stored number in name field. when i search dinesh , Search comes with exact result but when i use number search, That is 3333 Search has no result. What i done wrong on the code Zend_Search_Lucene_Field::Text.
Is there any way for search number/char/alphanumeric (kumar123) ?
Thanks in Advance
Finally i found by declaring "Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());" and use Zend_Search_Lucene_Field::Keyword instead of Zend_Search_Lucene_Field::Text