Unable to nest (group) Stackdriver logs outside of AppEngine - stackdriver

Following this guide: https://medium.com/google-cloud/combining-correlated-log-lines-in-google-stackdriver-dd23284aeb29 I tried to nest two logs using the sample json:
{"httpRequest": {"status": 200, "latency": "1.010 s", "requestUrl": "https://example.com/1", "requestMethod": "GET", "remoteIp": "1.2.3.4", "userAgent": "my-user-agent", "responseSize
": 1023}, "logging.googleapis.com/trace": "3dea50fd-0e2e-4bfd-bf61-0ded0f2ff82b", "severity": "INFO"}
{"message": "child message!", "labels": {"name": "child-log"}, "logging.googleapis.com/trace": "3dea50fd-0e2e-4bfd-bf61-0ded0f2ff82b", "severity": "INFO"}
Indeed, the requests are grouped - I now have a "show all logs for this trace" button. But they are separate log entries, and not nested like they would be in AppEngine.
How would a structured logging json look like for two entries logged outside of AppEngine that will be nested?

Related

Can't create stack from template using Openstack Heat API

I'm trying to create a stack from a template using the Heat API. I'm using the API reference here as a guide. I have the following json in a file called single-server-template.json:
{
"stack_name": "api-test",
"template": {
"heat_template_version": "rocky",
"description": "Testing Heat API\n",
"resources": {
"server1": {
"type": "OS::Nova::Server",
"properties": {
"name": "Server1",
"image": "Ubuntu 22.04 (Jammy)",
"flavor": "alt.st1.small",
"key_name": "my_key",
"networks": "Internal"
}
}
}
}
}
I'm sending it with this: curl -X POST -H "X-Auth-Token:$OS_TOKEN" -d #single-server-template.json https://$OS_HOST_URL:8004/v1/$OS_PROJECT_ID/stacks
I've been at it for hours but no matter what I send I get a 400 error:
{"code": 400, "title": "Bad Request", "explanation": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "error": {"type": "HTTPBadRequest", "traceback": null, "message": "The server could not comply with the request since it is either malformed or otherwise incorrect."}}
Things I've tried:
confirmed my environment vars are filled in correctly before sending
confirmed that the template itself is valid by spinning it up from the UI console
confirmed that other endpoints that require auth work as expected
screaming and/or crying
Can anyone confirm that what I've got is correct, or test it against your own openstack instance? The only other thing I can think of is that maybe my openstack provider has an issue with their API

Can fluentbit forward fluentbit_metrics as plain text instead of a JSON object to a port?

I am trying to send fluentbit metrics to an external source for processing. My understanding from the documentation is that the fluentbit_metrics input is intended to be used with output plugins that are for specific telemetry solutions like Prometheus, OpenTelemetry, etc. However, for my purposes, I cannot actually use any of those solutions and instead have to use a different bespoke metrics solution. For this to work, I would like to just send lines of text to a port that my metrics solution is listening on.
I am trying to use the fluentbit forward output to send data to this endpoint, but I am getting an error in response from my metrics solution because it is receiving a big JSON object which it can't parse. However, when I output the same fluentbit_metrics input to a file or to stdout, the contents of the file is more like what I would expect, where each metric is just a line of text. If these text lines were what was being sent to my metrics endpoint, I wouldn't have any issue ingesting them.
I know that I could take on the work to change my metrics solution to parse and process this JSON map, but before I do that, I wanted to check if this is the only way forward for me. So, my question is, is there a way to get fluentbit to send fluentbit_metrics to a forward output where it does not convert the metrics into a big JSON object? Is the schema for that JSON object specific to prometheus? Is there a reason why the outputs differ so substantially?
Here is a copy of an example config I am using with fluentbit:
[SERVICE]
# This is a commented line
Daemon off
log_level info
log_file C:\MyFolder\fluentlog.txt
flush 1
parsers_file .\parsers.conf
[INPUT]
name fluentbit_metrics
tag internal_metrics
scrape_interval 2
[OUTPUT]
Name forward
Match internal_metrics
Host 127.0.0.1
Port 28232
tag internal_metrics
Time_as_Integer true
[OUTPUT]
name stdout
match *
And here is the output from the forward output plugin:
{
"meta": {
"cmetrics": {},
"external": {},
"processing": {
"static_labels": []
}
},
"metrics": [
{
"meta": {
"ver": 2,
"type": 0,
"opts": {
"ns": "fluentbit",
"ss": "",
"name": "uptime",
"desc": "Number of seconds that Fluent Bit has been running."
},
"labels": [
"hostname"
],
"aggregation_type": 2
},
"values": [
{
"ts": 1670884364820306500,
"value": 22,
"labels": [
"myHostName"
],
"hash": 16603984480778988994
}
]
}, etc.
and here is the output of the same metrics from stdout:
2022-12-12T22:02:13.444100300Z fluentbit_uptime{hostname="myHostName"} = 2
2022-12-12T22:02:11.721859000Z fluentbit_input_bytes_total{name="tail.0"} = 1138
2022-12-12T22:02:11.721859000Z fluentbit_input_records_total{name="tail.0"} = 12
2022-12-12T22:02:11.444943400Z fluentbit_input_files_opened_total{name="tail.0"} = 1

StackDriver Custom Metric Resource Type cloud_composer_environment

I have a problem when I create timeseries on StackDriver.
So basically I create time series by executing the API from this site https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/create
and for the resource type I set it as `cloud_composer_environment'.
and the JSON looks like
"resource": {
"type": "cloud_composer_environment",
"labels": {
"project_id": "MY PROJECT ID",
"environment_name": "MY ENVIRONTMENT",
"location": "us-central1"
}
},
and when I execute the API, the result was
{
"error": {
"code": 400,
"message": "One or more TimeSeries could not be written: Metrics cannot be written to cloud_composer_environment.: timeSeries[0]",
"status": "INVALID_ARGUMENT"
}
}
and I dont know How to fix it, there is no information why was it a bad request
Composer stackdriver metrics are not publicly writable today and we are currently working on exposing more workflow-related metrics. Meanwhile, you may want to create your own metrics for reporting and/or use composer stackdriver logs for monitoring/alerting as described here.

Does the RingCentral Call Log API Return a "Missed" Value?

In the RingCentral Online Account Portal (https://service.ringcentral.com) and endpoint apps, the call log display shows whether a call was Inbound, Outbound or Missed.
In looking at the API Reference for the Call Log API, it seems that it only sends back Inbound or Outbound for "Direction". Does the developer Call Log API return a "Missed" value? Is there another way to get this information via the Call Log API?
Ref: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefCallLog.html
This question appears to be in reference to the Online Account Portal UI's "Type" column as shown in this screenshot:
The web UI's "Type" column shows Inbound, Outbound or Missed. This can be generated by using the response properties for both direction and result.
direction API response property will be Inbound or Outbound
result API response property is an enumerated value that includes Missed and other values including Voicemail which is the example screenshot. A full list is available in the link below:
Ref: https://developer.ringcentral.com/api-docs/latest/index.html#!#ResultStatusValues
Here is an example response:
{
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/11111111/call-log?view=Simple&showBlocked=true&withRecording=false&dateFrom=2018-08-27T06:18:00.000Z&page=1&perPage=100",
"records": [
{
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/11111111/call-log/22222222?view=Simple",
"id": "22222222",
"sessionId": "33333333",
"startTime": "2018-08-27T17:38:12.634Z",
"duration": 27,
"type": "Voice",
"direction": "Inbound",
"action": "Phone Call",
"result": "Missed",
"to": {
"phoneNumber": "+16505550101"
},
"from": {
"phoneNumber": "+16505550102",
"name": "LOS ALTOS CA",
"location": "Los Altos, CA"
}
}
],
...
}
Please read this blog to find out more information you can find from the call log.

google prediction api "hello prediction" tutorial

I have run through the Google Prediction API tutorials and documentation for "hello prediction - https://cloud.google.com/prediction/docs/hello_world
However when training the model in the developer console my request fails with the following output:
Request:
POST https://www.googleapis.com/prediction/v1.6/projects/959568262740/trainedmodels?key={YOUR_API_KEY}
{
"id": "language_id",
"storageDataLocation": "http://storage.googleapis.com/2341234/language_id.txt"
}
Response:
400 OK
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Training data file is empty.",
"locationType": "other",
"location": "id"
}
],
"code": 400,
"message": "Training data file is empty."
}
}
I've implemented Authorize requests using OAuth 2.0: - is there anything else that I should be doing, or that may have changed between Google PRediction API v 1.6 and the tutorial. Any link to any additional tutorial or article on the subject would also be extremely valuable so can debug myself!
Your storageDataLocation is not correct.
When you go to the Overview tab in Google Developers Console, you'll find your Project ID: xxxxx (example) and the bucket you've stored in is called yyyy (example).
Then replace the "storageDataLocation:" "xxxxx/yyyy". Should solve this problem. You need the relative path to Google Storage, and not the absolute web path.

Resources