<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: mnlth</title>
    <description>The latest articles on DEV Community by mnlth (@mnlth).</description>
    <link>https://dev.to/mnlth</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F376752%2Fed4301b3-57cb-461b-8935-55500a75970b.png</url>
      <title>DEV Community: mnlth</title>
      <link>https://dev.to/mnlth</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mnlth"/>
    <language>en</language>
    <item>
      <title>Linting OpenAPI specs using Spectral</title>
      <dc:creator>mnlth</dc:creator>
      <pubDate>Sun, 09 May 2021 14:20:58 +0000</pubDate>
      <link>https://dev.to/mnlth/linting-openapi-specs-using-spectral-37b</link>
      <guid>https://dev.to/mnlth/linting-openapi-specs-using-spectral-37b</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This post details on linting swagger specification using spectral. When it comes to following standards, its always conversational and prone to deviations with human aspect. How good would it be to automate the verification of standards. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgxwkk10uzjzifsjo5omg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgxwkk10uzjzifsjo5omg.jpg" alt="Crowd decision on standards" width="800" height="1344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Its such a relief to hear about a positive move towards lint option on json and yaml variant of API specs. Yes, Spectral provides lint'n options to json or yaml objects. Unlike regular linters which checks for syntax, spectral provides an option to create your own ruleset to apply on the openapi swagger specification file.&lt;/p&gt;

&lt;p&gt;Spectral comes with built-in functions with provision to create custom functions. These custom functions can perform pattern checks, parameter checks, provided keys in an object and many more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;There are a few options available for installation and usage based on requirements. Lets look into these&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;node
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    npm install -g @stoplight/spectral
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;yarn
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    yarn global add @stoplight/spectral
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;run as binaries
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    curl -L 
https://raw.githack.com/stoplightio/spectral/master/scripts/install.sh | sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;docker&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Running docker image locally requires file to be copied on to volume mount&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    docker run --rm -it -v $(pwd):/tmp stoplight/spectral lint "/tmp/file.yaml"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If you want to run docker from CI, use docker command&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    docker run --rm -it stoplight/spectral lint "${url}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;

&lt;p&gt;Let me show simple usage of running docker locally on  &lt;code&gt;employee-openapi-spec.yaml&lt;/code&gt; using the command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --rm -it -v $(pwd):/tmp stoplight/spectral lint "/tmp/employee-openapi-spec.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openapi: 3.0.1
info:
  title: Employees API Spec
  description: Working with employee details
  version: v1
servers:
- url: http://localhost:8080/employees
  description: The employee api
tags:
- name: employee details api spec
paths:
  /api/v1/employees:
    summary: Employees
    description: API to work with employee details
    get:
      tags:
      - employees
      summary: Get list of employees
      description: Retrieve the list of employees and their details
      operationId: getEmployees
      responses:
        "200":
          description: request to get list of employees
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmployeeResponse'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the output looks like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;OpenAPI 3.x detected

/tmp/employee-openapi-spec.yaml
   2:6   warning  info-contact                   Info object should contain `contact` object.
  17:9   warning  operation-tag-defined          Operation tags should be defined in global tags.

✖ 2 problems (0 errors, 2 warnings, 0 infos, 0 hints)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;p&gt;With the ability to add linter enables to detect issues with API early on, as early as design phase. Isn't this an amazing benefit to shift left on design issues and save time for more precious work later. &lt;/p&gt;

&lt;p&gt;Spectral has three key building blocks: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rulesets&lt;/strong&gt; - act as a container for rules and functions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rules&lt;/strong&gt; - filters the object to a set of target values and specifies the function that is used to evaluate these values.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Functions&lt;/strong&gt; - accept a value and return any issues with its value.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As mentioned earlier, spectral comes with basic set of functions and a predefined set of style guides for openapi specs. Rules are created using one or more of these basic in-built functions to add onto the style guides. These additional ones could be organisational guardrails which can be centrally managed and enforced onto all the APIs being designed. These could be anything from &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;HTTP Basic is not allowed at this company&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;to checking &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Are all operations secured with a security schema&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Working with Rulesets
&lt;/h2&gt;

&lt;p&gt;Let's dive into exploring rulesets and working with custom functions. Since spectral supports linting of json and yaml objects, rulesets can also be in either of the formats. Often the ruleset filename goes like &lt;code&gt;.spectral.yaml&lt;/code&gt; which consists of two parts, &lt;em&gt;rules&lt;/em&gt; and &lt;em&gt;functions&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;In-built Spectral "oas" ruleset, OAS being shorthand for the OpenAPI Specification. In the above example, we saw a warning on &lt;code&gt;info-contact&lt;/code&gt;. This is one of the default ruleset of oas.&lt;/p&gt;

&lt;p&gt;Creating any custom rules requires &lt;code&gt;.spectral.yaml&lt;/code&gt; file in current working directory. Here's how a simple custom rule looks like.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Simple ruleset example&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rules:
  my-rule-one:
    description: Tags must have a description.
    given: $.tags[*]
    severity: error
    then:
      field: description
      function: truthy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rule is applied on the json element &lt;code&gt;tags&lt;/code&gt; defined under &lt;code&gt;given&lt;/code&gt; and the function is &lt;code&gt;truthy&lt;/code&gt; with reporting severity as &lt;code&gt;error&lt;/code&gt;. This means, if any of the specification &lt;code&gt;tags&lt;/code&gt; doesn't contain &lt;code&gt;description&lt;/code&gt;, linter will throw error.&lt;/p&gt;

&lt;p&gt;Spectral cli command to apply the rule:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;spectral lint employee-openapi-spec.yaml&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
. This command will now use custom rules file instead of default spectral ruleset.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Extending ruleset&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;extends: spectral:oas

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just by adding extends statement to the spec, you can import other default rulesets. So when the above created custom rule combined with default ruleset looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;extends: spectral:oas

rules:
  my-rule-one:
    description: Tags must have a description.
    given: $.tags[*]
    severity: error
    then:
      field: description
      function: truthy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is essentially to instruct spectral to apply default rules plus the additional custom rule.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Custom ruleset&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;extends: spectral:oas
rules:
  operation-2xx-response: warn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change the severity - update the default severity of rule by overwriting it. Different severity levels that can be used are &lt;code&gt;error&lt;/code&gt;, &lt;code&gt;warn&lt;/code&gt;, &lt;code&gt;info&lt;/code&gt;, &lt;code&gt;hint&lt;/code&gt;, and &lt;code&gt;off&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Turn off a rule&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;extends: [[spectral:oas, all]]
rules:
  my-rule-one: off
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here all the default spectral rules are enabled and only custom rule &lt;code&gt;my-rule-one&lt;/code&gt; is disabled.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Turn on a rule&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;extends: [[spectral:oas, off]]
rules:
  my-rule-one: true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is quite opposite to disabling a rule. Default rules are all disabled using &lt;code&gt;off&lt;/code&gt; flag and only &lt;code&gt;my-rule-one&lt;/code&gt; is enabled.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;There are a few more options to customise the rules to cover most of the organisational requirements. Also, it is a good start to see a working lint option available for swagger which removes the overhead of manually verifying and controlling the common design pattern for APIs. I'm pretty impressed and suggest trying this to see the benefit of automating early design flaw detection. Hope you find this useful. &lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://meta.stoplight.io/docs/spectral/README.md" rel="noopener noreferrer"&gt;Spectral documentation&lt;/a&gt;&lt;br&gt;
&lt;a href="https://meta.stoplight.io/docs/spectral/docs/reference/openapi-rules.md" rel="noopener noreferrer"&gt;OpenAPI Rules&lt;/a&gt; &lt;/p&gt;

</description>
      <category>swaggerlinter</category>
      <category>openapi</category>
      <category>lint</category>
      <category>apilinter</category>
    </item>
    <item>
      <title>Functionbeat for Streaming Cloudwatch Events to ElasticSearch</title>
      <dc:creator>mnlth</dc:creator>
      <pubDate>Mon, 11 May 2020 02:45:03 +0000</pubDate>
      <link>https://dev.to/mnlth/functionbeat-for-streaming-cloudwatch-events-to-elasticsearch-l5j</link>
      <guid>https://dev.to/mnlth/functionbeat-for-streaming-cloudwatch-events-to-elasticsearch-l5j</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsb85wswksvoft5e3j90t.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsb85wswksvoft5e3j90t.jpg" alt="hover"&gt;&lt;/a&gt;&lt;br&gt;
 Photo by &lt;a href="https://commons.wikimedia.org/wiki/User:Uspn" rel="noopener noreferrer"&gt;Bjørn Christian Tørrissen&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;With various serverless and opensource options available, it's easier to spin up a concept into some kind of working model with comparatively quicker than earlier times. With this advancement it becomes essential to be able to effectively monitoring the different components and solution.&lt;br&gt;
What makes monitoring easier than having single logcentral to be able to get a view of required metrics.&lt;/p&gt;
&lt;h1&gt;
  
  
  Functionbeat for Monitoring
&lt;/h1&gt;

&lt;p&gt;Yes, as an engineer, I would like to setup a dashboard with all required information. And functionbeat helps in achieving the same with as simple as writing a lambda to collect the logs from different sources. Functionbeat is one of Elastic's beat family allowing you to be able to stream logs from Kinesis, SQS, Cloudwatch (as of today) to single logcentral.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwf8zn52hyfaizez2kwao.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwf8zn52hyfaizez2kwao.png" alt="Functionbeat Architecture"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Collect the Cloudwatch Logs
&lt;/h1&gt;

&lt;p&gt;What we are focusing here is, functionbeat to read each row of cloudwatch logs and stream it to elasticsearch. With functionbeat deployed as serverless lambda to AWS, you should be able to achieve above.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0juj04hva2fm1djux525.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0juj04hva2fm1djux525.png" alt="Functionbeat Cloudwatch logs"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this post, we focus on collecting logs from cloudwatch group and shipping it to elasticsearch.&lt;br&gt;
&lt;code&gt;lambda -&amp;gt; Cloudwatch Logs -&amp;gt; Functionbeat -&amp;gt; Elasticsearch&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Setup a lambda with cloudwatch monitoring
&lt;/h5&gt;

&lt;p&gt;A lambda function with any business function generating logs and metrics to cloudwatch. &lt;/p&gt;
&lt;h5&gt;
  
  
  Setup Functionbeat lambda
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Download functionbeat distribution&lt;br&gt;
&lt;code&gt;https://www.elastic.co/guide/en/beats/functionbeat/current/functionbeat-installation.html&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Before deploying cloudwatch, ensure you have AWS profile set-up. Verify that the aws account and region are set correctly using&lt;br&gt;
&lt;code&gt;aws configure&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create S3 bucket from AWS console for the functionbeat to be uploaded to. The reference to created S3 bucket is provided as&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  functionbeat.provider.aws.endpoint: "s3.amazonaws.com"
  functionbeat.provider.aws.deploy_bucket: "functionbeat-deploy"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;4. For the functionbeat to be deployed, lambda should have required permissions to the AWS resources. Create IAM role with access permissions to&lt;br&gt;
&lt;code&gt;ec2, es, s3&lt;/code&gt;&lt;br&gt;
For detailed IAM cloudformation code refer to &lt;a href="https://github.com/mnlth1/functionbeat/blob/master/sample/functionbeat-iam.yml" rel="noopener noreferrer"&gt;sample&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5. Configure functionbeat in &lt;code&gt;functionbeat.yaml&lt;/code&gt; and setup lambda to add triggers to cloudwatch group defined in #1. &lt;code&gt;functionbeat-cloudwatch&lt;/code&gt; is the name of lambda function and &lt;code&gt;type&lt;/code&gt; representing the trigger type with actual values listed under &lt;code&gt;triggers&lt;/code&gt; configuration. We could configure multiple cloudwatch log group triggers as comma separated values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  functionbeat.provider.aws.functions:
    - name: fb-cloudwatch
      enabled: true
      type: cloudwatch_logs

      role: arn:aws:iam::xxawsaccountidxx:role/lambda.functionbeat.role

      triggers:
      - log_group_name: /aws/lambda/sample-lambda-events
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you would want to deploy the lambda as part of private cloud set-up, look at configuring &lt;code&gt;virtual_private_cloud&lt;/code&gt; with subnet details.&lt;/p&gt;

&lt;p&gt;Now, lets look at configure the output of these logs to be shipped to. It only requires to configure the elasticsearch host and port to be configured. Provided the AWS connectivity to elasticsearch is already established, hook into the host. Else, use the local elasticsearch distribution to verify.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  output.elasticsearch:
    hosts: ["localhost:9200"]
    protocol: http
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the elasticsearch setup requires credentials, the same can be configured under &lt;code&gt;output.elasticsearch&lt;/code&gt; with &lt;code&gt;username&lt;/code&gt; and &lt;code&gt;password&lt;/code&gt;. To verify the setup so far, we could simply run the command&lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;code&gt;./functionbeat test config -e&lt;/code&gt; &lt;/b&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Finally, we are ready to deploy functionbeat to AWS. Deploy command uploads the functionbeat to s3 bucket &lt;code&gt;functionbeat-deploy&lt;/code&gt; created as part of #3. Use the command:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;b&gt;&lt;code&gt;./functionbeat -v -e -d "*" deploy fb-cloudwatch&lt;/code&gt;&lt;/b&gt; &lt;/p&gt;

&lt;p&gt;This would create cloudformation stack in AWS creating required lambda and resources. Once successfully deployed, you should be able to navigate to cloudwatch and look at the functionbeat &lt;code&gt;fb-cloudwatch&lt;/code&gt; logs. You could enable debug logs on functionbeat to be able to view detailed logs, add config &lt;code&gt;logging.level: debug&lt;/code&gt; to &lt;code&gt;functionbeat.yaml&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;With any additional changes, you can update the functionbeat using &lt;code&gt;update&lt;/code&gt; command without requiring to recreate the whole function.&lt;br&gt;
&lt;b&gt;&lt;code&gt;./functionbeat -v -e -d "*" update fb-cloudwatch&lt;/code&gt;&lt;/b&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Improvements
&lt;/h5&gt;

&lt;p&gt;As part of the lambda function collecting and streaming logs, we could pick the required fields from log source. This could be configured as &lt;code&gt;processors&lt;/code&gt; to the function. Say, if its required  to drop field &lt;code&gt;noMuchUse&lt;/code&gt; from log group and enrich with host metadata, set up processor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  processors:
    - include_fields:
      fields: ["id"]
    - drop_fields: 
      fields: ["id.noMuchUse"]
    - add_host_metadata:
      netinfo.enabled: false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;References: &lt;br&gt;
&lt;a href="https://www.elastic.co/guide/en/beats/functionbeat/current/index.html" rel="noopener noreferrer"&gt;Functionbeat&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/mnlth1/functionbeat" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>functionbeat</category>
      <category>logs</category>
      <category>aws</category>
      <category>elastic</category>
    </item>
  </channel>
</rss>
