Issues with lifting stringified JSON - fluent-bit

need some help with fluentbit parsing.. really struggling here.
I've got an entry that currently looks like that in the stdout plugin:
[0] datapoints: [1635420146.768714629, {"log"=>"{"#timestamp": "2021-09-29T06:36:48.989Z", "#version": 1, "source_host": "17dcffbb12af", "name": "my_nice_log"}"}]
I'm trying to lift that log field so I'll get my inner JSON as a map.
Unfortunately, I'm getting the following error in the logs:
[2021/10/28 15:10:02] [ warn] [filter:nest:nest.5] Value of key 'log' is not a map. Will not attempt to lift from here
Tried to use JSON parser on that field, without success, it doesn't change anything, the JSON is still stringified.

Related

How can I fix a 501 error from the clockify API?

I'm getting a 501 response from the clockify API when trying to create a Time Entry using CreateTimeEntryRequest
I've verified I can query the API and get data from it, so I'm using the correct X-Api-Key, I've resolved a few issues with bad datetime formats, but I'm still getting the error.
URL I'm posting to:
https://api.clockify.me/api/workspaces/REMOVED/timeEntries/
My POST request header looks like this:
{"x-api-key": REMOVED, "Content-Type": "application/json"}
The body of the request is (For example):
{"start": "2019-01-28T14:53:04Z", "billable": false, "description": "Test Time Entry", "projectID": null, "taskID": null, "end": "2019-01-28T15:53:04Z", "tagIds": []}
I'm getting:
{"message": "Entity not created.", "code": 501}
And the time entry is not being created.
I expect some kind of success message
It has something to do with the "End" variable. If you remove it, it'll work. This of course means the timer will be running (also you will get a 400 error if you already have a timer running), so if you want to stop it, you'll have to immediately call PUT /workspaces/{workspaceId}/timeEntries/endStarted or if you want the stop time to be at some point in the past, you'll have to update the timer with PUT /workspaces/{workspaceId}/timeEntries/{id}. However the update doesn't seem to work either (same issue). My guess is they made a change to the endpoint (perhaps renamed the "end" variable), because I'm about 75% sure I used this API within the last month or so and it worked.
Hopefully someone from Clockify will see this and give an update. I had a similar issue happen with the "me" field in the GetSummaryReportRequest object. It stopped working and removing the field fixed it.

How to give empty value for argument in POST request for hyperledger composer rest server

I am trying to make a post request via R using the httr package to composer rest server. I have written a code and then created the composer rest server from it. These are my details
Request URL : http://localhost:3000/api/nl.amis.registry.fruits
Body: {
"$class": "nl.amis.registry.fruits",
"Id": "9",
"name": "orange",
"description": "string",
"count": ""
}
First, I have tried with the composer rest server. For my purpose, I needed the count to be blank and the value will be appended by another API call. I was able to make the transaction successfully with the count: "". This I was able to check in the test section of the composer playground. The remaining code works fine which appends the count variable later on.
Now I am writing an R code to make a similar transaction through POST request. Here I am facing an error that "count cannot be blank" and returns with error 422 Unprocessable entity. The content type I was used was application/json. While using the "count":{} , the post request process fine and i am getting "count":[object Object] in the response. But the later on code which does the appending will do something like count:"[object Object],1" wherein I am expecting "count":"1". Everything works fine while using the test in composer playground but while trying to access externally via rest API is creating the problem. Please help.
you can use an Optional keyword to declare a count in an asset of the model file. using Optional keyword you can post an empty value of count.
for example:
asset fruits identified by Id {
o String Id
o String name
o String description
o String count optional
}

Telegraf httpjson plugin error - must have one or more fields

i am using the httpjson plugin in telegraf.
My telegraf config looks like this:
[[inputs.httpjson]]
name = "info_metric"
servers = ["http://server.port/application/admin/info.json"]
method = "GET"
response_timeout = "5s"
The Json itself looks like this when i get it from my browser:
{"git":{"branch":"release/app_27.x","commit":{"id":"23cs3f","time":"2017-10-18T13:55:01+0200"}}}
Error message i get from the telegraf logs:
2017-10-25T11:02:11Z E! Error in plugin [inputs.httpjson]: http_json_info_metric: must have one or more fields
If you look at the httpjson documentation link here .
It mentions that only numerical values are extracted from the JSON.
Note that only numerical values are extracted and the type is float.
Looking at your JSON, it is not having any numerical value to extract and hence no fields are formed as stated in the error message.

R Bigquery Error : attempt to apply non-function API Data Failed to Parse

I am trying to do a simple Query with R and BigQueryR
https://github.com/cloudyr/bigQueryR:
I am not sure what is wrong but I keep getting an error (this might just be my lack of knowledge with R).
It is returning a list of projects and data sets correctly so I know it is connected.
I followed the guides on querying:
https://rdrr.io/cran/bigQueryR/man/bqr_query.html
bqr_query(projectId, datasetId, query, maxResults = 1000)
This is the command I put in:
result <- bqr_query("bigqyerytestproject2", "TestDataSet1", "SELECT * FROM TestTable3", maxResults = 1000)
and I get the error:
Error : attempt to apply non-function
Warning message:
In q(the_body = body, path_arguments = list(projects = projectId)) :
API Data failed to parse. Returning parsed from JSON content.
Use this to test against your data_parse_function.
But then I checked BigQuery and the query is going through successfully:
I am just connecting a small amount before I move a large data set but the results are:
[
{
"Name": "Season",
"Date": "2010-06-30",
"ID": "1"
},
{
"Name": "Test",
"Date": "2010-06-30",
"ID": "2"
}
]
Thanks in advance for your help
Depending on your app's needs, you might consider using bigrquery instead of bigQueryR. The difference is explained here.
Beyond that, I'd suggest filing an issue with the developer of the bigQueryR library.
I'll describe how I got past that same error in case it's helpful, though I think it might be a slightly different problem as mine was caused by a permissions error with Google Sheets.
To create the error, I can:
Create a Google Sheets spreadsheet
Use the spreadsheet as a source of a BigQuery table
Query the BigQuery table using bqr_query()
At this point an error will pop up due to insufficient permissions
After seeing the error I grant permission to edit the Google Sheet to my app
The error "Error : attempt to apply non-function" appears and I can't get rid of it.
If I don't query the table until after granting permission to my app, the error doesn't appear in the first place. So I just had to recreate the Google Sheet and BigQuery table.
Hope this helps!

Meteor: Match error: Failed Match.OneOf or Match.Optional validation (websocket)

I have a website that uses Meteor 0.9. I have deployed this website on OpenShift (http://www.truthpecker.com).
The problem I'm experiencing is that when I go to a path on my site (/discover), then sometimes (though not always), the data needed are not fetched by Meteor. Instead I get the following errors:
On the client side:
WebSocket connection to 'ws://www.truthpecker.com/sockjs/796/3tfowlag/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400
And on the server side:
Exception from sub rD8cj6FGa6bpTDivh Error: Match error: Failed Match.OneOf or Match.Optional validation
at checkSubtree (packages/check/match.js:222)
at check (packages/check/match.js:21)
at _.extend._getFindOptions (packages/mongo-livedata/collection.js:216)
at _.extend.find (packages/mongo-livedata/collection.js:236)
at Meteor.publish.Activities.find.user [as _handler] (app/server/publications.js:41:19)
at maybeAuditArgumentChecks (packages/livedata/livedata_server.js:1492)
at _.extend._runHandler (packages/livedata/livedata_server.js:914)
at _.extend._startSubscription (packages/livedata/livedata_server.js:764)
at _.extend.protocol_handlers.sub (packages/livedata/livedata_server.js:577)
at packages/livedata/livedata_server.js:541
Sanitized and reported to the client as: Match failed [400]
Can anyone help me to eliminate this error and get the site working? I'd be very grateful!
Tony
P.S.: I never got this error using localhost.
EDIT:
The line causing the problem the problem is this (line 41):
return Activities.find({user: id}, {sort: {timeStamp: -1}, limit:40});
One document in the activities collection looks like this:
{
"user" : "ZJrgYm34rR92zg6z7",
"type" : "editArg",
"debId" : "wtziFDS4bB3CCkNLo",
"argId" : "YAnjh2Pu6QESzHQLH",
"timeStamp" : ISODate("2014-09-12T22:10:29.586Z"),
"_id" : "sEDDreehonp67haDg"
}
When I run the query done in line 41 in mongo shell, I get the following error:
error: { "$err" : "Unsupported projection option: timeStamp", "code" : 13097 }
I don't really why this is though. Can you help me there as well? Thank you.
Make sure that you are passing an integer to skip and limit. Use parseInt() if need be.
You have a document on your website that does not match your check validation.
The validation you have is in app/server/publications.js:41
So the attribute in question exists in some way like Match.optional(Match.oneOf(xx)) but the document's attribute is neither of the values in Match.oneOf
You would have to go through your documents for the collection causing this and remove or correct the attribute causing this to match your check statement.
Update for your updated question.
You're running Meteor commands in the meteor mongo/mongo shell. The error you get is unrelated to the problem in Meteor, to sort in the mongo shell you would do activities.find(..).sort(), instead of activities.find(.., { sort : {..}). This is unrelated to the issue
The issue is most-likely that your id is not actually a string. Its supposed to be sEDDreehonp67haDg for the document you're looking for. You might want to use the debugger to see what it actually is.
I don't think you can use limit in client-side find queries. Removing limit from my query solves the problem. If you're looking for pagination, then you can either manually roll your own by passing a parameter to your Activities publication so that the limit is added to the server-side query along with an offset. There is also this pagination package.

Resources