AWS cloudwatch MSK metrics -> Firehose - amazon-web-services

I want to stream some metrics from the namespace AWS/Kafka to Kinesis Firehose and from there to a third-party application.
When I choose the namespace AWS/Kafka, I stream all the metrics from this namespace and it's a ton of data that I don't want.
If I want to choose only two metrics from this namespace (MaxOffsetLag & SumOffsetLag), there is a way to do this?
I heard there is a way by using a log group but I couldn't figure out how.

Related

How do you re-log errors to another Cloudwatch Stream?

I am monitoring our Serverless AWS Lambda application using Cloudwatch and Cloudwatch insights. In order to cut down cost on displaying errors and error graphs, I want to re-log our errors to an additional stream that is separate from all our normal interactions with our users.
I know you can add Cloudwatch subscriptions with filters, but when I try to use Kenesis Firehose, it only has those streaming to external log providers. What is the correct or best way to re-log these to another Cloudwatch stream if they meet a filter constraint?

What are the benefits of using statsD with cloud-watch-agent over AWS SDK?

We are currently sending metrics to Cloudwatch for every request using AWS SDK(putMetric call).
I was exploring another solution and there is one where we can use statsD with an cloudwatch-agent which will push metrics to Cloudwatch every x seconds.
What is the advantage of using statsD here? Will it be cost-effective? Will it it be fast? Should I even use statsD? Are there any alternative better than statsD?

Is it possible to stream AWS cloudwatch logs

I know its is possible to stream CloudWatch Logs Data to Amazon Elasticsearch Service. It is documented here, But is it possible to stream the logs data to a custom AWS Glue Job, or to an EMR Job?
The way streaming of CloudWatch Logs (CWLs) to ElasticSearch (ES) works, is that AWS creates a lambda function for you. So CWLs will stream to lambda first, and the lambda will then upload the log events to ES.
For Glue, you don't need lambda function, as glue can get its streaming data from kinesis streams. So you would have to setup CWL subscription to kinesis stream. The stream would be used as a source in a streaming Glue job.
For EMR you could also just stream log events from CWL to kinesis in the same way as for Glue. But to read the stream data in EMR, you would probably have to use EMR Input Connector for Kinesis.

How to use metric filter in cloudwatch logs

how can i display only the person name in cloudwatch dashbaord.
log : message:"Personname ABC",
able to filter the message using the query..filter #message like /Personname / |
display message
please help to display only the name i dont like to display'Personname' just the name ABC.
CloudWatch Metric filters are not used to extract text, they're used for counting the number of occurrences for a specific condition i.e. when the Persons name is ABC
After the CloudWatch Logs agent begins publishing log data to Amazon CloudWatch, you can begin searching and filtering the log data by creating one or more metric filters. Metric filters define the terms and patterns to look for in log data as it is sent to CloudWatch Logs. CloudWatch Logs uses these metric filters to turn log data into numerical CloudWatch metrics that you can graph or set an alarm on. You can use any type of CloudWatch statistic, including percentile statistics, when viewing these metrics or setting alarms.
If you're wanting to analyze your data take a look at using CloudWatch Logs Insights.
As #ChrisWilliams explained, the metric filters serve different purpose.
One way of filtering the logs is through log subscriptions:
You can use subscriptions to get access to a real-time feed of log events from CloudWatch Logs and have it delivered to other services such as a Amazon Kinesis stream, Amazon Kinesis Data Firehose stream, or AWS Lambda for custom processing, analysis, or loading to other systems.
Using subscriptions you could feed your logs into Kiensis Firehose in real-time, transform it using firehose transforamtions into format you desire and save it to S3. This way you can process the logs in a way you want and have them delivered to S3 for further analysis or long term storage.
Alternatively, can feed the logs directly to a lambda function, and from there you can do what you wish.

AWS Kinesis Connector Library

I am developing a real-time streaming application which needs to send information to AWS Kinesis streams and from there to AWS Redshift. Based on my reading and understanding of documentation, following are the options to push information from Kinesis Streams to Redshift:
Kinesis Streams -> Lambda Function -> Redshift
Kinesis Streams -> Lambda Function -> Kinesis Firehose -> Redshift
Kinesis Streams -> Kinesis Connector Library -> Redshift (https://github.com/awslabs/amazon-kinesis-connectors)
I found the Kinesis Connector option to be the best option for moving information from Streams to Redshift. However, I am not able to understand where do we deploy this library and how does this run? Does this need to run as a lambda function or as a java function on an EC2 instance. Based on the readme I am not able to get that information. In case anyone has worked with connectors successfully, I will appreciate the insight very much.
If you're using the Kinesis Connector Library then you want to deploy it on an EC2 instance, but using a Lambda function without the Connector Library is a lot easier and better in my opinion. It handles batching, scaling up your instance invocation and retries. Dead Letter Queues are probably coming soon too for Lambda + Kinesis.
Basically it's a lot easier to scale and deal with failures in Lambda.