I'm trying to parse some JSON log files(that have stackTraces within them) into Logstash, but I think the stack traces are not letting it happen.
here is my logstash conf: (one of the many confs I've tried )
input {
# This configuration works but the input file needs to be set in a format like so [{},{}]
file {
path => "/opt/logstash/confFiles/suite1.json"
start_position => beginning
codec => json
sincedb_path => "/opt/logstash/confFiles/suite1incedb"
}
}
filter {
json{
source => "message"
}
}
output {
stdout {codec => rubydebug}
}
This is the json TYPE I'm trying to work around (its the result of a jsonReporter for jasmine)
{
"suite1": {
"id": "suite1",
"description": "create process - simulate test 2",
"fullName": "create process - simulate test 2",
"failedExpectations": [],
"status": "finished",
"specs": [{
"id": "spec0",
"description": "should redirect to modeler after create a process",
"fullName": "create process - simulate test 2 should redirect to modeler after create a process",
"failedExpectations": [{
"matcherName": "toMatch",
"message": "Expected 'http://localhost:3000/#!/signin' to match /myDashboard/.",
"stack": "Error: Failed expectation\n at Env.<anonymous> (/home/ls/code/ph/app/tests/e2e/create-process.e2e.test.js:18:35)\n at /home/ls/code/ph/node_modules/protractor/node_modules/jasminewd2/index.js:95:14\n at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/home/ls/code/ph/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)\n at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (/home/ls/code/ph/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1518:8)\n at [object Object].wrapper [as _onTimeout] (timers.js:274:14)\n at Timer.listOnTimeout (timers.js:119:15)",
"passed": false,
"expected": {},
"actual": "http://localhost:3000/#!/signin"
}, {
"matcherName": "",
"message": "Failed: No element found using locator: By.id(\"selectedUser\")",
"stack": "Error: Failed: No element found using locator: By.id(\"selectedUser\")\n at stack (/home/ls/code/ph/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1441:17)\n at buildExpectationResult (/home/ls/code/ph/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1411:14)\n at Spec.Env.expectationResultFactory (/home/ls/code/ph/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:533:18)\n at Spec.addExpectationResult (/home/ls/code/ph/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:293:34)\n at Env.fail (/home/ls/code/ph/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:837:25)\n at Function.next.fail (/home/ls/code/ph/node_modules/protractor/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1776:19)\n at /home/ls/code/ph/node_modules/protractor/node_modules/jasminewd2/index.js:104:16\n at /home/ls/code/ph/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15\n at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/home/ls/code/ph/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)\n at notify (/home/ls/code/ph/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)",
"passed": false,
"expected": "",
"actual": ""
}],
"passedExpectations": [],
"status": "failed"
}]
},
"suite2": {
"id": "suite2",
"description": "login to PB Modeler",
"fullName": "login to PB Modeler",
"failedExpectations": [],
"status": "finished",
"specs": [{
"id": "spec1",
"description": "should redirect to myDashboard after login",
"fullName": "login to PB Modeler should redirect to myDashboard after login",
"failedExpectations": [{
"matcherName": "toMatch",
"message": "Expected 'http://localhost:3000/#!/signin' to match /myDashboard/.",
"stack": "Error: Failed expectation\n at Env.<anonymous> (/home/ls/code/ph/app/tests/e2e/login.e2e.test.js:18:37)\n at /home/ls/code/ph/node_modules/protractor/node_modules/jasminewd2/index.js:95:14\n at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/home/ls/code/ph/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)\n at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (/home/ls/code/ph/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1518:8)\n at [object Object].wrapper [as _onTimeout] (timers.js:274:14)\n at Timer.listOnTimeout (timers.js:119:15)",
"passed": false,
"expected": {},
"actual": "http://localhost:3000/#!/signin"
}],
"passedExpectations": [],
"status": "failed"
}]
}
I've try many configurations now,
If I try to send it like it is above, Logstash will not map it correctly.
So what I did was remove the spaces and set beautify=false in the reporter and surrounded it with "[ ]" to make it look like an array and Logstash would "randomly" take it.
-So what would it be a good approach to parse both the nested JSON objects,taking into account the stackTraces, so that when its sent to ES and kibana is a workable DATA.
-How can I make a mapping for this structure or Model the data so that it understands it when sending this to ELK
I'm using
ES 2.1
Logstash 2.1
Kibana 4.3.1
Filebeat 1.0.1
Related
We are trying to get data from the google search console API with dimension types - web, discover, googleNews, news, image, video. They are all listed in the google API documentation here
But we are getting a successful response from google API only for search types 'web', 'image', and 'news', please see it below
Request URL: https://www.googleapis.com/webmasters/v3/sites/sc-domain%3Amydomain.com/searchAnalytics/query?fields=responseAggregationType%2Crows
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "web",
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
Queries Count: 239752
========================================================================================
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "image",
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
Queries Count: 1827
====================================================================================
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "web",
"dimensionFilterGroups": [
{
"groupType": "and",
"filters": [
{
"dimension": "country",
"operator": "contains",
"expression": "GBR"
}
]
}
],
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
Queries Count: 9073
When we are making the same request with the search type 'discover' or 'googleNews' we are getting an error in the response as below
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "discover",
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
We also have tried to make the API request for the full URL without sc-domain parameter as one below
https://www.googleapis.com/webmasters/v3/sites/https%3A%2F%2Fwww.mydomain.com/searchAnalytics/query?fields=responseAggregationType%2Crows
But still, we are getting the same errors.
My question is - what is wrong with our requests and how to get data from the google search console API for the search types 'discover' and 'googleNews'? And is there any way to get more informative error messages from google search console API responses, that will provide a bit more explanation about the reason for the error occurred?
I created a Elasticsearch datasource in Grafana. Its config:
{
"datasource": {
"id": 4,
"orgId": 1,
"name": "Elasticsearch",
"type": "elasticsearch",
"typeLogoUrl": "",
"access": "direct",
"url": "http://localhost:9200/recipes",
"password": "",
"user": "",
"database": "recipes",
"basicAuth": false,
"basicAuthUser": "",
"basicAuthPassword": "",
"withCredentials": false,
"isDefault": true,
"jsonData": {
"esVersion": 77,
"logLevelField": "",
"logMessageField": "",
"maxConcurrentShardRequests": 256,
"timeField": "timestamp"
},
"secureJsonFields": {},
"version": 25,
"readOnly": false
},
"id": 4,
"message": "Datasource updated",
"name": "Elasticsearch"
}
And I noticed that Grafana makes OPTIONS requests this url for data:
http://localhost:9200/_msearch?max_concurrent_shard_requests=5
Without no data.
Could you say please how to get data from indexes?
P.S. Grafana of latest version. Elasticsearch of 7.7.0.
Multi search request have specific format
The multi search API executes several searches from a single API
request. The format of the request is similar to the bulk API format
and makes use of the newline delimited JSON (NDJSON) format.
Header :
(Required, object) Contains parameters used to limit or change the
subsequent search body request.This object is required for each search
body but can be empty ({}) or a blank line.
Body :
(Optional, object) Contains parameters for a search request:
Below is valid request
GET recipes/_msearch?max_concurrent_shard_requests=5
{}
{}
You are using elasticsearch version 7.7, but your grafana datasource config show it is configured as it was using an older version, 5.6+
{
"esVersion": 56,
"logLevelField": "",
"logMessageField": "",
"maxConcurrentShardRequests": 256,
"timeField": "timestamp"
}
Try to change the version in your datasource config to 7.0+
I am trying to create a Google Tag Manager trigger using the GTM API v2.
I'm trying to achieve the following:
I want a trigger to fire on Page view in pages where the variable Mobile or not is false
I tried to call the API with these parameters
{
"name": "Desktop Users Test",
"type": "pageview",
"filter": [
{
"parameter": [
{
"type": "template",
"value": "{{ Mobile or not }}",
"key": "arg0"
},
{
"type": "boolean",
"value": "false",
"key": "arg1"
}
],
"type": "equals"
}
]
}
But it returning a 400 Bad Request error with this response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument",
"message": "Unable to parse trigger data"
}
],
"code": 400,
"message": "Unable to parse trigger data"
}
}
If I create a trigger with only name, type and empty filters it works
{
"name": "Will work too",
"type": "pageview",
"filter": []
}
// will return a "200 OK" response
Please, what are the right parameters to create this trigger?
I'm using the Microsoft Botframework and the node.js version of botbuilder. My bot can send messages to kik (and other services) using the shared message fields - the ones that the botconnector allows for all messages.
However, when I try to use channelData fields for kik, I get a 400 (Bad Request) error message. I have already adapted my message to use the tip from:
Bot Connector: Sending custom message to Kik results in 400 error
but I'm still missing something.
Thanks for any help on mapping the message properly for kik.
Code that results in the 400 error:
session.send({
type: "Message",
to: { "channelId":"kik", "address": session.message.from.address},
from: { "channelId":"kik", "address": session.message.to.address},
replyToMessageId: session.message.id,
conversationId: session.message.conversationId,
channelConversationId: session.message.channelConversationId,
channelMessageId: session.message.channelMessageId,
channelData:
{
"messages": [
{
"chatId": session.message.channelConversationId,
"type": "text",
"to": session.message.from.name,
"text": "test text",
"noForward": true
}
]
}
});
I've also tried sending only the channelData portion, but that also results in the 400 error:
channelData:
{
"messages": [
{
"chatId": session.message.channelConversationId,
"type": "text",
"to": session.message.from.name,
"text": "test text",
"noForward": true
}
]
}
I believe your data is malformed. Kik expects text content as "body" not "text". Try:
"messages": [
{
"chatId": session.message.channelConversationId,
"type": "text",
"to": session.message.from.name,
"body": "test text",
"noForward": true
}
I need to add checkboxes merge-field with choices to a list.
API key is valid, other requests work and I'm doing such request:
POST https://us12.api.mailchimp.com/3.0/lists/424242/merge-fields
Body: {"name": "provider_accounts", "type": "checkboxes", "options": { "choices": ["BMW", "Audi", "Toyota"]}, "tag": "provider_accounts"}
And I got an error for some reason!
{
"type": "http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
"title": "Invalid Resource",
"status": 400,
"detail": "The resource submitted could not be validated. For field-specific details, see the 'errors' array.",
"instance": "",
"errors": [
{},
{}
]
}
BTW if I change the type to radio request works and new merge-field is created.