By using AWS re:Post, you agree to the Terms of Use
/Amazon CloudWatch Logs/

Questions tagged with Amazon CloudWatch Logs

Sort by most recent
  • 1
  • 90 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

AppSync request mapping template errors not logged in CloudWatch

I have a simple resolver that has a simple Lambda function as a data source. This function always throws an error (to test out logging). The resolver has request mapping template enabled and it is configured as follows: ``` $util.error("request mapping error 1") ``` The API has logging configured to be as verbose as possible yet I cannot see this `request mapping error 1` from my CloudWatch logs in `RequestMapping` log type: ``` { "logType": "RequestMapping", "path": [ "singlePost" ], "fieldName": "singlePost", "resolverArn": "xxx", "requestId": "bab942c6-9ae7-4771-ba45-7911afd262ac", "context": { "arguments": { "id": "123" }, "stash": {}, "outErrors": [] }, "fieldInError": false, "errors": [], "parentType": "Query", "graphQLAPIId": "xxx" } ``` The error is not completely lost because I can see this error in the query response: ``` { "data": { "singlePost": null }, "errors": [ { "path": [ "singlePost" ], "data": null, "errorType": null, "errorInfo": null, "locations": [ { "line": 2, "column": 3, "sourceName": null } ], "message": "request mapping error 1" } ] } ``` When I add `$util.appendError("append request mapping error 1")` to the request mapping template so it looks like this: ``` $util.appendError("append request mapping error 1") $util.error("request mapping error 1") ``` Then the appended error appears in the `RequestMapping` log type but the `errors` array is still empty: ``` { "logType": "RequestMapping", "path": [ "singlePost" ], "fieldName": "singlePost", "resolverArn": "xxx", "requestId": "f8eecff9-b211-44b7-8753-6cc6e269c938", "context": { "arguments": { "id": "123" }, "stash": {}, "outErrors": [ { "message": "append request mapping error 1" } ] }, "fieldInError": false, "errors": [], "parentType": "Query", "graphQLAPIId": "xxx" } ``` When I do the same thing with response mapping template then everything works as expected (errors array contains `$util.error(message)` and outErrors array contains `$util.appendError(message)` messages. 1. Is this working as expected so the `$util.error(message)` will never show up in CloudWatch logs? 2. Under what conditions will `errors` array in `RequestMapping` log type be populated? 3. Bonus question: can the `errors` array contain more than 1 item for either `RequestMapping` or `ResponseMapping` log types?
0
answers
0
votes
3
views
asked 21 days ago

ec2tagger: Unable to describe ec2 tags for initial retrieval: AuthFailure: AWS was not able to validate the provided access credentials / cloudwatch log agent, vpc endpoints

I got error: "ec2tagger: Unable to describe ec2 tags for initial retrieval: AuthFailure: AWS was not able to validate the provided access credentials" in cloudwatch log agent on an ec2 instance that has: 1. CloudWatchAgentServerRole -- this is default AWS managed role attached to the instance, this default role already allow ""ec2:DescribeTags"," in its policy. <---- NOTE this 2. Its NACL allowed all outbound and allowed all vpc's CIDR network range inbound 3. Cloudwatch log agent config file's region is correct 4. telnet ec2.us-east-2.amazonaws.com 443 or telnet monitoring.us-east-2.amazonaws.com 443 or telnet logs.us-east-2.amazonaws.com 443 under the ec2 instance all return successful connection (Connected <..> Escape character is '^]') I also create three vpc endpoints: logs (com.amazonaws.us-east-2.logs), monitoring (com.amazonaws.us-east-2.monitoring), ec2 (com.amazonaws.us-east-2.ec2) interface endpoints. They have SG that allowed all VPC's CIDR network range inbound. The idea is to expose metrics to cloudwatch via vpc endpoints. Despite all above setup, I can't make cloudwatch agent to work and it keeps echo above error complain about credentials is not valid even though the REGION in config file is correct and traffic between instance and cloudwatch is allowed.
1
answers
0
votes
22
views
asked a month ago

Problem receiving IP 127.0.0.1 at service startup instead of local IP

**Context:** We've got a number of load balanced web servers running on Windows OS in AWS using C# .NET (5). We have a web server application as well as a Windows Service running on the same machine and we have problems with logging from the Windows Service. **Problem Description**: Since we have many servers running load balanced, we name the log stream with the private IP number in order to distinguish which machine that potentially has problems. This private IP is extracted at startup of the application (for both the Windows Service and the Web Server.) This is usually sucessfull, but yesterday we had an incident when one Windows Service log stream was labeled with 127.0.0.1 instead of the local IP number. Eventually I was able to pinpoint which server it was, restarted the windows service, which made the private IP number appear instead in the new log stream name. **?: Suggested reason with possible solution:** I'm guessing this is a race condition error. The machine has not received it's private IP number yet by AWS network before our service asked for it. **If so we can wait for the real IP to appear just to make sure we get the right IP number in our log. ** I have three question related to this: **Questions:** 1. **Do you see any other reason than the one I suggested why the IP number 127.0.0.1 appears? ** 2. ** Is there a better solution available than the one I suggested?** 3. **Is there a way, using an AWS API of some sort to get hold of the public IP for the server?** Here's the code how we extract the private IP address in this context: ``` var hostName = System.Net.Dns.GetHostName(); var ipAddresses = System.Net.Dns.GetHostAddresses(hostName); var ipv4Address = ipAddresses.FirstOrDefault(ip => ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork); ```
2
answers
0
votes
14
views
asked a month ago
1
answers
0
votes
12
views
asked 3 months ago
  • 1
  • 90 / page