Finding all the logs that have the same trace id, but only for failed operations - sumologic

All my logs have a trace id in them (which identifies a single request inside the infrastructure).
Is there any way to search for a keyword, lets say "Error" for example, and get all the logs that contain the keyword "Error", but also, all the log entries that have the same trace id as the logs that matched for error?

Related

Allow only given parameters value

I my RoR (v 6.1) application (only API) i have route
resources :cars
This is valid URL:
http://localhost/cars
To find cars with fuel pb95 i use:
http://localhost/cars?fuel=pb95
Only pb95, pb98, gas are allowed for fuel?
How do I limit the ability to specify a fuel type outside of the list?
If someone enters a value outside the list should I display that this value cannot be used, or display that there are no cars that meet this condition?
Whitch approach looks better?
You have a few options for how to handle this.
One approach would be to check the fuel type in your controller, and render an error response if they pass an invalid fuel type.
Another approach would be via route constraints. Instead of using query params, you can use special routes to receive your params:
get 'cars/:fuel_type', to: "cars#index", fuel_type: /(pb95|pb98)/, as: :cars_with_fuel_type
This way, if an invalid fuel type is provided, the route wont match and they'll get a 404.
If you want something other than a 404, then the first option gives you more control over the error response.

What can be reasons of error "None of the chained routers were able to generate route: Route not found" in SymfonyCMF?

Getting error from file:
/app/vendor/symfony-cmf/routing/src/ChainRouter.php
"None of the chained routers were able to generate route: Route '/cms/routes/can' not found".
I am guessing it should find this route from database table phpcr_nodes, it exists in database:
but it does not find.
This method call gives this error:
$this->router->generate('/cms/routes/can', array(), RouterInterface::ABSOLUTE_URL)
Where should I look for? How to make it find the route? There does this method look for routes? Maybe I have to add somewhere and it does not even look to database?
Got an answer - it finds route what is in phpcr_nodes.path but somewhere is done a filtering of those rows, by config. So even if the row exists with such route, it does not find because of config. Do not know where that filtering is done but at least for doing current task was enough.
Somebody can append if know how the filtering of phpcr_nodes rows can be done so router does not find them.

SAPUI5 & ODataModel V2: Find out which request groups have pending requests

I'm using ODataModel V2 and have 3 deferred request groups. If there are requests for more than one group I have to submit them in specific order.
Therefore I need to know which group has pending requests. Is there already a smart method for?
Definition of my request groups
Entry creations via Method "createEntry" are collected into group "create"
Entry deletions via Method "remove" are collected into group "delete"
Everything else is collected into group "changes"
What I've found out so far
The "delete" group is easy, if there is one, it's contained in "oDataModel.mDeferredRequests".
The "create" group is only contained in "mDeferredRequests" if there are also requests for the "changes" group. So if it's contained in "mDeferredRequests" I know that there are requests for both "create" and "changes".
But if there are only requests for either "create" or "changes" I've found only the way via method "getPendingChanges".
The newly created entities have the groupId included within the metadata like so:
NewObject('id-123456-00'):
Attribute: "123"
__metadata:
created:
changeSetId: "chgSet"
eTag: undefined
error: undefined
groupId: "create"
...
type: "..."
uri: "/sap/opu/odata/sap/..."
The changed entities have no groupId, they look like so:
UpdatedObject(Key='123'):
Attribute: "abc"
__metadata:
id: ".../sap/opu/odata/sap/..."
type: "..."
uri: ".../sap/opu/odata/sap/..."
So my only idea at the moment is to loop over the entries from "getPendingChanges" and check if there's a groupId or not.
As I'm not happy with this solution I'd like to ask you if there's a smarter way to determine the groups with pending requests.

Rails 5 server side error handling

Lets say I have some code in my controller action and I am expecting params[:name] to be a string not empty. My user interface notifies the user that hea can't have empty string, but let's say someone uses an app like postman, can they cause the server to crash by sending an empty string that can cause errors because of methods being called on nil class?
The server would not "crash" in that scenario. In any case it will just raise an error and respond with a 500, but it will not "crash" as in making it unusable to process other requests

Why does this Microsoft Graph request works for most users, but returns "Bad Request - Error in query syntax" for guest users?

Sometimes, I do a request to get the value of several fields for a given user.
Here is an example of such a request that works for a given user(the id corresponds to a user of type "Member"):
https://graph.microsoft.com/v1.0/users/bba8407c-2f05-4e91-b27e-a207689a085f?$select=passwordProfile,aboutMe,accountEnabled,assignedLicenses,assignedPlans,birthday,businessPhones,city,companyName,country,department,displayName,givenName,hireDate,imAddresses,interests,jobTitle,mail,mailboxSettings,mailNickname,mobilePhone,mySite,officeLocation,onPremisesImmutableId,onPremisesLastSyncDateTime,onPremisesSecurityIdentifier,onPremisesSyncEnabled,passwordPolicies,pastProjects,postalCode,preferredLanguage,preferredName,provisionedPlans,proxyAddresses,responsibilities,schools,skills,state,streetAddress,surname,usageLocation,userPrincipalName,userType
No problem here. But doing the same request for another user of type "Guest", I get an Http 400 (bad request). Here is a request that fails, even if the format is exactly the same:
https://graph.microsoft.com/v1.0/users/3e3fac9d-ad76-4f9a-b86c-b4691a524572?$select=passwordProfile,aboutMe,accountEnabled,assignedLicenses,assignedPlans,birthday,businessPhones,city,companyName,country,department,displayName,givenName,hireDate,imAddresses,interests,jobTitle,mail,mailboxSettings,mailNickname,mobilePhone,mySite,officeLocation,onPremisesImmutableId,onPremisesLastSyncDateTime,onPremisesSecurityIdentifier,onPremisesSyncEnabled,passwordPolicies,pastProjects,postalCode,preferredLanguage,preferredName,provisionedPlans,proxyAddresses,responsibilities,schools,skills,state,streetAddress,surname,usageLocation,userPrincipalName,userType
So the request syntax is identical, the only part that changes is the user id. But the second one returns "Bad Request - Error in query syntax". What is going on here? Why can I not do that request for guest users?
I can reproduce this problem for any tenant. It never works for any guest user.
Request-id of the failing request: 49e80d99-5074-4404-900f-e1d14889bf2b
it appears that some of those properties are unavailable for guest users. If you want to fetch non-guest users, you can use $filter syntax such as https://graph.microsoft.com/v1.0/users?$filter=userType eq 'Member'

Resources