How to change Kibana-4's default Time Filter? - kibana-4

I have created a dashboard in Kibana-4 and shared on my Web-app. But its default time filter is 15 minutes.
How to change the default time filter in kibana-4?

In 4.5.0, you should be able to change it anytime in the Kibana ui by navigating to "Settings"->"Advanced". See this link. Just edit the timepicker:timeDefaults to something like { "from": "now-90d", "to": "now", "mode": "quick" }

You can preset time filter in dashboard link. For example setting to last 6 hours:
kibana-host:5601/#/dashboard/My-Dashboard?_g=(time:(from:now-6h,mode:quick,to:now))

The time-filter is not saved as part of the dashboard, and shouldn't be in my opinion. A dashboard shows you the data organized in a certain kind of way, and each user should be able to modify the date-range of their view however they see fit.
If you're interested in changing the kibana default, you can do so by modifying the code.
Go to the file 'services/timefilter.js', and there is a variable called timeDefaults. You can modify it to match the default value you're interested in.
In the code it looks like this:
var timeDefaults = {
from: 'now-15m',
to: 'now'
};
The from and to properties are parsed using ISO8601 format.

At least as of Kibana version 7.4, and possibly for earlier releases as well:
From the left menu click on Management, then select Advanced Settings from the Kibana top menu.
Here you can change the defaults of a Kibana dashboard.
Search for timepicker:timeDefaults and click on edit and change the from value from now-15m to the value you want to set, using s for seconds, m for minutes, h for hours, w for weeks, M for months, d for days, or y for years.
I wanted to see data of past 2 years so I have set it as
{
"from": "now-2y",
"to": "now",
"mode": "quick"
}
Finally, click on the Save button to the right of the edited field:
Hope it helps.

Related

Display the date of the last value for a custom metric in Datadog

I'm searching to display in a DD Dashboard the date of the last value of a metric. I can use a simple QueryValue field for that, however I don't know how I can get the date of this metric instead of its value.
Example :
mymetric = [21,5,42]
let's say that the relevant dates for those metrics are
['1/1/2022', '1/2/2022', '27/2/2022']
I'd like to display 27/2/2022.
For now, I'm displaying only the value with this query
"queries": [
{
"query": "max:mycounter{$env}",
"data_source": "metrics",
"name": "query1",
"aggregator": "last"
}
]
Is it possible with Datadog ?
In fact I've found a workaround, but that seems a little bit unoptimized. I push also from my code mycounter.date_day mycounter.date_month and mycounter.date_year. And then I can display day month year in 3 different QueryValue.
Regards,
Blured.
This is not a use case Datadog metrics are designed for. Any solution you find is going to be pretty hacky.
This seems like maybe instead of a custom metric, you'd want to be sending a log or event, with date/time attributes that you can display. Even that doesn't really sound close to what you're looking for though.
If you really wanted to get this working in a clean way, I suppose you could try developing your own custom Datadog widget as an app: https://www.datadoghq.com/blog/datadog-apps/ (reference docs)
But whatever your goal is might just have to be redesigned to make more sense for what Datadog is built for.

What are aliases in elasticsearch for?

I recently started working in a company that uses Elasticsearch. While most of its concepts are somewhat similar to relational databases and I am able to understand them, I still don't quite get the concept of aliases.
I did not find any such question here and the information provided on the Elasticsearch website did not help much either.
Can someone explain what aliases are for and ideally include an example of a situation where they are needed?
aliases are like soft links or shortcuts to actual indexes
the advantage is to be able to have an alias pointing to index1a while building or re-indexing on index2b and the moment of swapping them is atomic thanks to the alias, to which all code should point
Renaming an alias is a simple remove then add operation within the same API. This operation is atomic, no need to worry about a short period of time where the alias does not point to an index:
[EDIT] as pointed out #wholevinski aliases have other functionalities like:
Multiple indices can be specified for an action ...
all the info is in the page you have linked
[EDIT2] more on why the need/benefit of the atomicity
the key being "zero downtime" https://en.wikipedia.org/wiki/Zero_unscheduled_downtime or https://en.wikipedia.org/wiki/High_availability
https://www.elastic.co/guide/en/elasticsearch/guide/current/index-aliases.html
We will talk more about the other uses for aliases later in the book. For now we will explain how to use them to switch from an old index to a new index with zero downtime.
#arhak covered the topic pretty well.
One use case that (at least) made me understand the value of indices was the need to remove out-of-date documents and more specifically when using time-based-indices.
For example, you need to keep the logs of an application for at least one year. You decide to use time-based-indices, meaning you save into indices with the following format: 2018-02-logs, 2018-03-logs etc.. In order to be able to search in every index you create the following alias:
POST /_aliases
{
"actions": [{
"add": {
"alias": "current-logs", "indices": [ "2018-02-logs","2018-03-logs" ]
}
}]
}
And query like:
GET /current-logs/_search
Another advantage is that you can delete the out-of-date values very easily:
POST /_aliases
{
"actions": [
{ "remove": { "alias": "current-logs", "index": "logs_2018-01" }}
]
}
and DELETE /logs_2018-01
Aliases are basically created to group a set of indices and make them accessible regarless the name they have. Is a pointer to a set of indices. You can also apply a query/condition to all of these indices. It is very useful when performing queries or creating dashboards over the same group of indices all the time. In addition, if in the future you change the name of the indices that are part of an alias, the end users will not notice that change since it is for transparent for them and you will only update the pointer.

Google Calendar API stopped returning events

Since today I have problem with one of 2 similar calls to Google Calendar API v3:
calendar.events.list
Both calls are requesting list of assignemnts and use privateExtendedProperty to filter them, but key=Value pairs are different.
When I have privateExtendedProperty set to myStatus=READY it returns events I need,
but when I set privateExtendedProperty to myId=agxzfm1haWxmb29nYWVyNQsSDE9yZ2FuaXphdGlvbiIVYWN0aXZlZ2FtaW5nbWVkaWEuY29tDAsSBENhc2UYkcHA3wgM
it returns no events, though I'm sure there are several events with this myId...
It appears that the calendar API list is returning an empty list when querying by a privateExtendedProperty with 90 characters long.
Everything worked fine for years, but it suddenly broke for some of my users this morning...
This is my request:
GET googleapis.com/calendar/v3/calendars/****/events?privateExtendedProperty=myId%3Dagxzfm1haWxmb29nYWVyNQsSDE9yZ2FuaXphdGlvbiIVYWN0aXZlZ2FtaW5nbWVkaWEuY29tDAsSBENhc2UYwauk6QgM&key={YOUR_API_KEY}
This is the result I see in API explorer:
{
"kind": "calendar#events",
"etag": "\"*****\"",
"summary": "*****",
"description": "*****",
"updated": "2018-02-20T03:18:35.098Z",
"timeZone": "Asia/Tokyo",
"accessRole": "owner",
"defaultReminders": [
],
"nextSyncToken": "CJDv1KDEs9kCEJDv1KDEs9kCGAU=",
"items": [
]
}
Update 1:
My privateExtendedProperty looks like this:
{
"myStatus": "READY",
"myId": "agxzfm1haWxmb29nYWVyNQsSDE9yZ2FuaXphdGlvbiIVYWN0aXZlZ2FtaW5nbWVkaWEuY29tDAsSBENhc2UYkcHA3wgM",
"another": "Another value",
"another2": "Another value2"
}
When I query events with "myStatus=READY" - event is returned, but when I do the same with "myId=agxzfm1..." - it returns emtpy list.
Update 2:
For those who have the same issue. As per suggestion, I created a new calendar and then duplicated some test data and tried long value in privateExtendedProperty query and it returned event as expected. It means, if this is a bug - not all calendars are affected and moving things to a new calendar might be a way to go.
The document for Extended Properties says the limitations as follows.
The maximum size of a property's key is 44 characters, and properties with longer keys will be silently dropped.
The maximum size of a property's value is 1024 characters, and properties with longer values will be silently truncated.
An event can have up to 300 shared properties totaling up to 32kB in size (keys size + value size).
An event can have up to 300 private properties, totaling up to 32kB in size (keys size + value size), across all "copies" of the event.
From this, it seems that your case is out of the above limitations. In my environment, also I tried your situation. As the result, it was found that myId=agxzfm1haWxmb29nYWVyNQsSDE9yZ2FuaXphdGlvbiIVYWN0aXZlZ2FtaW5nbWVkaWEuY29tDAsSBENhc2UYkcHA3wgM can be used.
So can you confirm the following points again?
It seems that your result retrieved by API explorer doesn't included extendedProperties in the property of items. When you set extendedProperties, it can be seen. If you use fields, it might be not able to be seen.
Can you set extendedProperties with myId=agxzfm1haWxmb29nYWVyNQsSDE9yZ2FuaXphdGlvbiIVYWN0aXZlZ2FtaW5nbWVkaWEuY29tDAsSBENhc2UYkcHA3wgM again?
You can set it using calendar.events.patch.
When you retrieve events with myId=agxzfm1haWxmb29nYWVyNQsSDE9yZ2FuaXphdGlvbiIVYWN0aXZlZ2FtaW5nbWVkaWEuY29tDAsSBENhc2UYkcHA3wgM using calendar.events.list, if you use the URL encoded value of myId%3dagxzfm1haWxmb29nYWVyNQsSDE9yZ2FuaXphdGlvbiIVYWN0aXZlZ2FtaW5nbWVkaWEuY29tDAsSBENhc2UYkcHA3wgM, please try to use the value without URL encode.
If this was not useful for you and I misunderstand your question, I'm sorry.
Edit :
If you retrieve the event using calendar.events.get, can the extendedProperties you set be seen? If you cannot see it, please insert extendedProperties again.
The endpoint is GET https://www.googleapis.com/calendar/v3/calendars/### calendar Id ###/events/### event Id ###?fields=extendedProperties%2Fprivate
In my environment, the same endpoint of yours works fine. So as a test, can you try to create new calendar and run that query? Because I worried whether the recent update of calendar affects this situation.

Tracking conversions using the action_target_id doesn't seem to work anymore

When using the action breakdown to view the offsite conversions:
act_[ACT_NUM]/reportstats?date_preset=last_3_days&increment=1&data_columns=['campaign_group_id','campaign_group_name','actions']&actions_group_by=['action_type','action_target_id']&limit=1000
amongst the response will usually be something like:
...
{
"action_type": "offsite_conversion.lead",
"action_target_id": "[object_id_1]",
"value": 3
},
{
"action_type": "offsite_conversion.other",
"action_target_id": "[object_id_1]",
"value": 1
},
{
"action_type": "offsite_conversion.other",
"action_target_id": "[object_id_2]",
"value": 7
}
...
We've been using the action_target_id to link to conversion pixels by their id and this still mostly works. However the facebook report on conversion pixels seems to have added the action values for stats with the same tag as the conversion pixel but with different action_target_ids. For example the above referenced object_id_1 for the lead stat appears to link to a creative but its value has been added to the total conversions for one of the lead tagged conversion pixels attached to the account. Not sure if it's relevant but this seems to only be happening to multi product ads on the accounts I've looked at.
Anyone have an idea why this might be the case and whether or not it is possible to consistently link the response from the action breakdown in report stats to conversion pixels?

Forcing JQuery Datatable to load data via AJAX upon selection of a date range

I have the wonderful jquery data tables currently loading data using ajax.
The code is pretty much the same as the example I took it from which can be found at: http://www.datatables.net/release-datatables/examples/server_side/pipeline.html
I found this the best example because it incoporates pagination, sorting and also the search box into the ajax requests. The search box allows you to type in key words and this triggers the ajax function which includes the search value as a $_GET var to the server script.
This is a small preview of my table with table tools etc. loaded.
http://img828.imageshack.us/img828/9778/previewxjh.png
As you can see the main focus here is the filament groups date range plugin which I have added. I have finished with this now, and have a fail safe for the duplicate event firing problem etc. its ready to go and just needs including in the ajax pipeline - which is where I have been stuck for the last day or so.
fnDataTablesPipeline appears to be just an interim and doesnt reference the search box at all, so I can't figure out how the search box is working, and I am unsure if this is the right place to go including my date range value (everything I have tried just leads me to a dead end)
I want to use my onChange event for the date range filter, and apply it exactly the same way that the search box works. When the value is changed, simply pass it as a get variable so that my php script can deal with it there. I have concerns regarding the paging, and I will probably need to just reset back to page one after the date is changed (not sure how I am going to deal with this just yet, but thats the next step)
I need help telling datatables to refresh from the ajax source, and include the date range as a get parameter to the server side script (like when the search box value changes)
- sounds straight forward, but this is where I am breaking down and not making good use of my time due to the lack of understanding.
Is there anyone that has implemented similar that can help me?
The biggest problem right now is how to force the refresh from my date range onChange event, and of course include the single string value which contains my dates (which I know how to cover server side)
Many Thanks,
Chris
EDIT: I actually managed to get this working before I finished for the day. I'll post my code when I get back in the office tomorrow, it was actually surprisingly easy - I was tackling it completely wrong.
After changing date..
oTable.fnClearTable(0);
oTable.fnDraw();
Include var in pipeline
function fnDataTablesPipeline ( sSource, aoData, fnCallback, dateRange ) {
aoData.push( { "name": "dateRange", "value": $('#dateRangePicker').val(), } );
...
Obtain var in php script
$_GET['dateRange']

Resources