detect if mobile or tablet with logstash v7 filter user-agent - logstash

Using logstash v7, filter user-agent, How can I get information about device type?
I got:
{
"version": "92.0.4515.105",
"name": "Chrome",
"device": "Huawei Browser",
"os_major": "10",
"minor": "0",
"os_version": "10",
"os_name": "Android",
"major": "92",
"patch": "4515",
"os_full": "Android 10",
"os": "Android"
}
I see this is not possible with UAP library (https://github.com/ua-parser/uap-core/issues/31) and elasticsearch have done its own implementation for ingest pipeline feature: https://github.com/elastic/elasticsearch/pull/69322 .
I really want to stay with logstash, is that possible?

Related

Azure Rule engine File extension with json file

I am trying to create a rule engine in a cdn endpoint. like this:
But using a Json file (The result in the image has been achieved manually but now i want to automate this).
So far I got this:
"deliveryPolicy": {
"description": "Rewrite and Redirect",
"rules": [
{
"name" : "UrlFileExtension",
"order": 2,
"conditions": [
{
"name": "UrlFileExtension",
"parameters": {
"#odata.type": "#Microsoft.Azure.Cdn.Models.UrlFileExtensionMatchConditionParameters",
"Extension": 0,
"operator": "LessThanOrEqual",
"matchValues": [0]
}
}
],
"actions": [
{
"name": "UrlRewrite",
"parameters": {
"#odata.type": "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlRewriteActionParameters",
"sourcePattern": "/",
"destination": "/index.html",
"preserveUnmatchedPath": false
}
}
]
},
The action works just fine, but the urlfileextentionI cant get it to work, it does not recognize the odata.type either.
Please any hint ot suggestion how to fix the condition?
You might want to try with this odata.type for the condition
"#odata.type": "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFileExtensionMatchConditionParameters",
instead of
"#odata.type": "#Microsoft.Azure.Cdn.Models.UrlFileExtensionMatchConditionParameters",
https://learn.microsoft.com/en-us/python/api/azure-mgmt-cdn/azure.mgmt.cdn.models.urlfileextensionmatchconditionparameters?view=azure-python
(I'm aware the documentation says Python, I could not find better, but it could be your solution)

MS Teams bot deploy rejects auto-generated manifest.json with message "Manifest parsing has failed"

I redeployed my (sideloaded) Teams app that implements a very simple bot that auto-messages rooms every day.
This was working for a long time, and I made a slight change so I needed to redeploy, remove from the Teams room, and add it back.
After I removed and tried to add it back (without changing any of the settings) I now get an error telling me "Manifest Parsing has failed"
I also get the following errors in my console log:
Manifest is below. This was 100% generated within Teams, and is not something I made edits to myself, so not sure why it's telling me it can't parse (some fields redacted):
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.8/MicrosoftTeams.schema.json",
"manifestVersion": "1.8",
"version": "1.0.0",
"id": "dbb36443-1bce-48e0-81d2-b30aa3698144",
"packageName": "com.prosourcer-teams",
"developer": {
"name": "MY NAME",
"websiteUrl": "URL",
"privacyUrl": "URL",
"termsOfUseUrl": "URL"
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "ps-app",
"full": "ps-chatBot"
},
"description": {
"short": "short desc",
"full": "full desc"
},
"accentColor": "#FFFFFF",
"bots": [
{
"botId": "bfcb70de-e093-4733-b236-742eb3b0aad8",
"scopes": [
"personal",
"team",
"groupchat"
],
"supportsFiles": false,
"isNotificationOnly": false
}
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"URL"
]
}
UPDATE: If I try to add the bot to an individual team, I also get the following error in my console. I have confirmed that appId is correct, not sure where I'm supposed to be setting my TeamsId:
If there's an existing installation somewhere still around it might be causing this. Try incrementing the version number. Currently it's 1.0.0, try bumping even to 1.0.1 or 1.1.0.
Update - maybe there's an issue in Teams - there is a question just before yours today with a similar issue - see "Manifest parsing has failed" when installing teams apps from App Studio . Sounds like an issue with Teams or App Studio. If so, you can try manually uploading the manifest to your internal company store.
Manually change the manifest version to 1.7 (down from 1.8). As of Oct 15, 2020 that is the work around.
manifestVersion": "1.7"
(The Teams App Studio app generates the manifest with version 1.8, but the Teams client parsing fails as you have also run into)

Auto-Table generation in Cassandra with kafka connect cassandra sink

I am using confluent.connect.cassandra.CassandraSinkConnector, for kafka connect cassandra sink.
I wanted to know if it was possible to auto-generate cassandra tables from the kafka topic using io.confluent.connect.cassandra.CassandraSinkConnector as connector.
If it is possible, can you please suggest what configuration to set to enable this feature. I have tried all the configurations mentioned in the documentation, but I was not successful in creating a table.
This is the configuration i am using:
{
"name": "cassandra-test4",
"config": {
"connector.class": "io.confluent.connect.cassandra.CassandraSinkConnector",
"tasks.max": "3",
"topics": "orders-topic2",
"cassandra.contact.points": "my_ip",
"cassandra.keyspace": "test_cas",
"cassandra.write.mode": "Insert",
"cassandra.table.manage.enabled": "true",
"cassandra.sink.route": "test_cas.orders",
"key.converter.schema.registry.url": "http://localhost:8081",
"value.converter.schema.registry.url": "http://localhost:8081",
"value.converter": "io.confluent.connect.avro.AvroConverter",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"flush.size": "1",
"cassandra.keyspace.create.enabled": "true",
"name": "cassandra-test4"
},
"tasks": [
{
"connector": "cassandra-test4",
"task": 0
},
{
"connector": "cassandra-test4",
"task": 1
},
{
"connector": "cassandra-test4",
"task": 2
}
],
"type": null
}
This is should be done by setting cassandra.keyspace.create.enabled & cassandra.table.manage.enabled properties to true. See documentation.
But be really careful - it's very easy to get schema disagreement in your cluster, and then you need to do additional steps to recover from it. It's better pre-create tables before starting connector...

Can not deploy Entries in Entities to DialogFlow

I'm currently working with Custom Entities (Developer Entities) via modifying Entities JSON Docs
I know how to create & link manually my Custom Entities with my Intents.
I had
en-US.json with customized entities (Valid json)
{
"invocation": "Test",
"intents": [
...
],
"dialogflow": {
"intents": [
{
"name": "Default Fallback Intent",
"auto": true,
"webhookUsed": true,
"fallbackIntent": true
},
{
"name": "Default Welcome Intent",
"auto": true,
"webhookUsed": true,
"events": [
{
"name": "WELCOME"
}
]
}
],
"entities": [
{
"id": "f060b6f7-7a17-4355-9fa6-3ce02f0ce33a",
"name": "additionalTopic",
"isOverridable": true,
"entries": [
{
"synonyms": [
"usuk",
"us",
"uk",
"us music",
"uk music",
"play usuk",
"play us",
"play uk",
"play us music",
"play uk music"
],
"value": "usuk"
},
{
"synonyms": [
"vn",
"vietnamese"
],
"value": "vn"
}
],
"isEnum": false,
"automatedExpansion": false
}
]
}
It looks like correct as Entities JSON Docs
I build with jovo command line : jovo build
It generated additionalTopic.json & additionalTopic_usersays_en.json in folder platforms/googleAction/dialogflow/entities, as image
These steps in above looks like OK, right?
Then I deploy to DialogFlow via jovo command line : jovo deploy --project-id PROJECT_ID
It deployed success as usually.
Last steps I going to DialogFlow Console to check Custom Entities I created,
And here it is.
Entities name appeared, but where is synonyms?
What I want is after deployed, it expects as first image in above.
Please take a look and help me find the way,
Really thanks.
p/s : I'm using DialogFlow Console version 2.
It looks like this is the bug in jovo-framework.
In this time, jovo-framework only support for DialogFlow version 1.
jovo releases note : https://github.com/jovotech/jovo-framework-nodejs/releases

How to visualize NodeJS .cpuprofile

I use v8-profiler to profile my NodeJS app. It generates a .cpuprofile file.
I used to be able to visualize the content of the file with Google Chrome built-in DevTools. However, Chrome recently changed the file format for profiling results and Chrome is no longer able to read .cpuprofile files.
Note: My goal is to see the call tree and bottom-up. I do not care about flame chart.
Thanks.
I ended up downloading an old Chromium version. http://commondatastorage.googleapis.com/chromium-browser-continuous/index.html?prefix=Win_x64/381909/
There is a vscode extension for viewing .cpuprofile:
Flame Chart Visualizer for JavaScript Profiles
https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-js-profile-flame
Yes, it seems the format has changed. From NodeJS v9.11.1 I'm getting a tree-like JSON structure:
{
"typeId": "CPU",
"uid": "1",
"title": "Profile 1",
"head": {
"functionName": "(root)",
"url": "",
"lineNumber": 0,
"callUID": 1319082045,
"bailoutReason": "no reason",
"id": 17,
"hitCount": 0,
"children": [
{
"functionName": "(anonymous function)",
"url": "...",
"lineNumber": 726,
"callUID": 3193325993,
"bailoutReason": "no reason",
"id": 16,
"hitCount": 0,
"children": [
{
...
From Chromium 66.0.3359.117 I'm getting a flat structure:
{
"nodes": [
{
"id": 1,
"callFrame": {
"functionName": "(root)",
"scriptId": "0",
"url": "",
"lineNumber": -1,
"columnNumber": -1
},
"hitCount": 0,
"children": [
2,
3
]
},
{
...
What worked for me is the chrome2calltree tool, which takes the old format used by NodeJS and turns it into a .prof file that tools like KCacheGrind and QCacheGrind can open.

Resources