Tamia  Walter

Tamia Walter

1595353800

Splunk Logging in Lambda Using Low Code Approach

A centralized logging management solution like Splunk, Datadog, Sumologic, etc. enables organizations to collect, analyze, and display logs through a single pane of glass.

In this article, we will see how application logs can be sent to Splunk from lambda using the Kumologica Splunk node.

Kumologica is a free low-code development tool to build serverless integrations. You can learn more in this medium article.

Use Case

In this use case, we have a mobile app application that consumes a Mobile Channel API. Behind the mobile API, we have an Order FulFilment API. The Mobile API invokes the Order FulFilment API for completing the process. When the mobile app sends the very initial request it has a Tracking id. The Tracking id traverses from the Mobile Channel API to Order FulFilment API and back.

The message passed across both applications needs to be traced based on the Tracking id in Splunk.

log managementPrerequisite

1. Kumologica designer installed in your machine. https://kumologica.com/download.html

2. Splunk cloud Trial account

Implementation

For the above-mentioned use case, we will be creating two API’s, a Mobile Channel API, and an Order FulFilment API.

Order fulfillment API

1. Open the Kumologica designer and Create a New project. And provide the name of the project as OrderFulFilmentService

2. Remove the default hello world flow.

3. Drag and drop EventListener Node from the pallet to the canvas and open the EvenListener node settings and configure the following.

Display Name : POST /order  

Event Source : Amazon API gateway   

Verb : POST   

URL : /order

4. Add Splunk Node from the Logging category.

By default, Splunk Node will not be available as part of the default Logging category.

To install the Splunk node, Go to Add More Nodes Option on the bottom of the pallet and click InstallSplunk. Once Installation has completed a restart of the Designer will be required. Open the Splunk Node settings and configure the following.

Plain Text

Display Name: Log_Entry     
Host: hostname of your splunk trial account     
Port: 8088
Message: {“TrackingID” : msg.payload.TxnID,”ServiceName”:”Order_FullFillment”, “Data”: msg.payload }     
Splunk HEC Token: Splunk HTTP Event collector Token

5. Wire the EventListener Node to the Splunk Node.

6. Drag and drop the Datamapper node from the palette to the canvas.

We are using the Datamapper node to mimic the response after an Order processing.

Open the Datamapper settings and configure the following.

Display Name: Order_ProcessResponse

Mapping:

JSON

{
 “TrackingID” : msg.payload.TxnID,
 “OrderID” : msg.payload.OrderID,
 “Status” : “Processed”
}

If you are not familiar with using the DataMapper node then would recommend going through the following article.

7. Wire the Splunk Node to the DataMapper Node.

8. Add the EventListener End node from the palette to the canvas. Open the settings and configure the following.

Display Name: Success   

Payload: msg.payload

With this, we have completed the development of our Order FulFilment API.

post/order

Now let’s deploy the API as lambda to your AWS account. If you are not familiar with the deployment of a Kumologica flow I would recommend having a walkthrough on the following medium article.

Note: Copy the service URL that you receive on the terminal after a successful deployment.

#tutorial #integration #aws #serverless #logging #microservice #lambda #splunk

What is GEEK

Buddha Community

Splunk Logging in Lambda Using Low Code Approach
Tamia  Walter

Tamia Walter

1595353800

Splunk Logging in Lambda Using Low Code Approach

A centralized logging management solution like Splunk, Datadog, Sumologic, etc. enables organizations to collect, analyze, and display logs through a single pane of glass.

In this article, we will see how application logs can be sent to Splunk from lambda using the Kumologica Splunk node.

Kumologica is a free low-code development tool to build serverless integrations. You can learn more in this medium article.

Use Case

In this use case, we have a mobile app application that consumes a Mobile Channel API. Behind the mobile API, we have an Order FulFilment API. The Mobile API invokes the Order FulFilment API for completing the process. When the mobile app sends the very initial request it has a Tracking id. The Tracking id traverses from the Mobile Channel API to Order FulFilment API and back.

The message passed across both applications needs to be traced based on the Tracking id in Splunk.

log managementPrerequisite

1. Kumologica designer installed in your machine. https://kumologica.com/download.html

2. Splunk cloud Trial account

Implementation

For the above-mentioned use case, we will be creating two API’s, a Mobile Channel API, and an Order FulFilment API.

Order fulfillment API

1. Open the Kumologica designer and Create a New project. And provide the name of the project as OrderFulFilmentService

2. Remove the default hello world flow.

3. Drag and drop EventListener Node from the pallet to the canvas and open the EvenListener node settings and configure the following.

Display Name : POST /order  

Event Source : Amazon API gateway   

Verb : POST   

URL : /order

4. Add Splunk Node from the Logging category.

By default, Splunk Node will not be available as part of the default Logging category.

To install the Splunk node, Go to Add More Nodes Option on the bottom of the pallet and click InstallSplunk. Once Installation has completed a restart of the Designer will be required. Open the Splunk Node settings and configure the following.

Plain Text

Display Name: Log_Entry     
Host: hostname of your splunk trial account     
Port: 8088
Message: {“TrackingID” : msg.payload.TxnID,”ServiceName”:”Order_FullFillment”, “Data”: msg.payload }     
Splunk HEC Token: Splunk HTTP Event collector Token

5. Wire the EventListener Node to the Splunk Node.

6. Drag and drop the Datamapper node from the palette to the canvas.

We are using the Datamapper node to mimic the response after an Order processing.

Open the Datamapper settings and configure the following.

Display Name: Order_ProcessResponse

Mapping:

JSON

{
 “TrackingID” : msg.payload.TxnID,
 “OrderID” : msg.payload.OrderID,
 “Status” : “Processed”
}

If you are not familiar with using the DataMapper node then would recommend going through the following article.

7. Wire the Splunk Node to the DataMapper Node.

8. Add the EventListener End node from the palette to the canvas. Open the settings and configure the following.

Display Name: Success   

Payload: msg.payload

With this, we have completed the development of our Order FulFilment API.

post/order

Now let’s deploy the API as lambda to your AWS account. If you are not familiar with the deployment of a Kumologica flow I would recommend having a walkthrough on the following medium article.

Note: Copy the service URL that you receive on the terminal after a successful deployment.

#tutorial #integration #aws #serverless #logging #microservice #lambda #splunk

Brain  Crist

Brain Crist

1594670400

COVID-19 Has Changed the Future of Low-Code. Are You Ready?

How can we turbo-charge growth for the modern business? A hint: ride on the coattails of low-code software development and bridge the digital gap.

Given the benefits of rapid development - lower costs, faster delivery, and greater accessibility - the low-code market is pushing forward to a digital revolution and is projected to reach $27.23 billion in the year 2022. But for those with an eye for faster development cycles will know, today’s leading platforms - such as OutSystemsMendixLinx - were offering rapid development tools from as early as the naughties.

Since then, there has been no looking back.

But before we get to 2022, we need to understand 2020 - the year of Coronavirus - which has ushered in a new reality: Being an adaptable, the digital enterprise has never been more critical. So, how do we adapt, and what lies ahead in 2020?

Pushing to Digital Can Affect Positive Change

In this era of digital transformation, the ability to ship products quickly is a precious trait. Embracing the changes in technology and the newest innovations is no longer limited to the high-flying startups in Silicon Valley or Fortune 500s. Today, every company needs to be a technology company in some way.

Specifically for development, we have come to a place where thanks to many libraries and frameworks, what would’ve once taken many developers to build from scratch is now more often than not, replaced by very few IT pros plumbing different things together.

And if this is the trend to follow (efficiency!), it is why we are seeing so many “no-code” or “low-code” solutions popping up all over the place.

The truth is that in 2020, there are increasingly fewer reasons to write code. From small one or two-person businesses to unicorn startups and large multinationals, every company needs a developer or a team of developers to help with scaling digitally. The difference today is the increased demand to deliver products quickly, meaning that developers need a way to move faster. For those willing to break the model of traditional development, the solution can be found in low-code tools.

And the benefits are apparent:

  • **Speed **- Instead of time-consuming code, low-code platforms use visual models, eliminating the need for knowledge of syntax or boilerplate code.
  • **Flexibility **– Solving unique business problems via customization, without being exorbitantly expensive (read: hours writing code), will always prevail.
  • **Automation **– Less time wasted in trying to get things to work, and more time spent in actually getting them done. Win-win.

#software development #application development #digital transformation #software application development #low-code #low-code platform #low code benefits #low code programming

Chaz  Homenick

Chaz Homenick

1602725748

Why You Should Consider Low-Code Approach to Building a REST API

APIs have been around for decades – they allow different systems to talk to each other in a seamless, fast fashion – yet it’s been during the past decade that this technology has become a significant force.

So then why all the interest in APIs? We all know the usual stories – Uber, Airbnb, Apple Pay… the list goes on, and the reasons are plentiful. Today the question is, how? Perhaps you are looking to differentiate your business or want a first-mover advantage.  How can you execute quickly and at low cost/risk to try new market offerings?

An API provides several benefits to an organisation, but without a dedicated team of trained developers, it might seem like an implausible option. Developers are expensive, and it can take months to develop an API from the ground up. If you don’t fancy outsourcing or have the capability in house to build internal APIs, a low-code platform might just be the answer.

Before You Begin: Plan long-term, start small.

For a small one-page application, this might only be a day or two of talking with stakeholders and designing business logic. The purpose of this first step is to ensure that the API will cover all use cases and provides stakeholders with what they need. Refactoring an entire coding design due to missing business logic is not only frustrating for the development team but adds high cost and time to the API project.

During the planning and design stage, remember that running an API requires more infrastructure than just resources to execute endpoint logic. You need a database to store the data, an email system to send messages, storage for files, and security to handle authorisation and authentication. These services can be farmed out to cloud providers to expedite the API build process (e.g. AWS provides all these infrastructure components, but Microsoft Azure is an optional cloud provider with SendGrid as the email application.)

**Planning considerations: **An API “speaks” in JSON or XML, so the output provided to client applications should be decided. Should you choose to later create endpoints for public developer consumption, you could offer both for ease-of-use and fostering more adoption. Ensuring the API follows OpenAPI standards will encourage more adoption and attract more developers.

#api #rest-api #api-development #restful-api #low-code-platform #low-code #build-a-rest-api #low-code-approach

Tyrique  Littel

Tyrique Littel

1604008800

Static Code Analysis: What It Is? How to Use It?

Static code analysis refers to the technique of approximating the runtime behavior of a program. In other words, it is the process of predicting the output of a program without actually executing it.

Lately, however, the term “Static Code Analysis” is more commonly used to refer to one of the applications of this technique rather than the technique itself — program comprehension — understanding the program and detecting issues in it (anything from syntax errors to type mismatches, performance hogs likely bugs, security loopholes, etc.). This is the usage we’d be referring to throughout this post.

“The refinement of techniques for the prompt discovery of error serves as well as any other as a hallmark of what we mean by science.”

  • J. Robert Oppenheimer

Outline

We cover a lot of ground in this post. The aim is to build an understanding of static code analysis and to equip you with the basic theory, and the right tools so that you can write analyzers on your own.

We start our journey with laying down the essential parts of the pipeline which a compiler follows to understand what a piece of code does. We learn where to tap points in this pipeline to plug in our analyzers and extract meaningful information. In the latter half, we get our feet wet, and write four such static analyzers, completely from scratch, in Python.

Note that although the ideas here are discussed in light of Python, static code analyzers across all programming languages are carved out along similar lines. We chose Python because of the availability of an easy to use ast module, and wide adoption of the language itself.

How does it all work?

Before a computer can finally “understand” and execute a piece of code, it goes through a series of complicated transformations:

static analysis workflow

As you can see in the diagram (go ahead, zoom it!), the static analyzers feed on the output of these stages. To be able to better understand the static analysis techniques, let’s look at each of these steps in some more detail:

Scanning

The first thing that a compiler does when trying to understand a piece of code is to break it down into smaller chunks, also known as tokens. Tokens are akin to what words are in a language.

A token might consist of either a single character, like (, or literals (like integers, strings, e.g., 7Bob, etc.), or reserved keywords of that language (e.g, def in Python). Characters which do not contribute towards the semantics of a program, like trailing whitespace, comments, etc. are often discarded by the scanner.

Python provides the tokenize module in its standard library to let you play around with tokens:

Python

1

import io

2

import tokenize

3

4

code = b"color = input('Enter your favourite color: ')"

5

6

for token in tokenize.tokenize(io.BytesIO(code).readline):

7

    print(token)

Python

1

TokenInfo(type=62 (ENCODING),  string='utf-8')

2

TokenInfo(type=1  (NAME),      string='color')

3

TokenInfo(type=54 (OP),        string='=')

4

TokenInfo(type=1  (NAME),      string='input')

5

TokenInfo(type=54 (OP),        string='(')

6

TokenInfo(type=3  (STRING),    string="'Enter your favourite color: '")

7

TokenInfo(type=54 (OP),        string=')')

8

TokenInfo(type=4  (NEWLINE),   string='')

9

TokenInfo(type=0  (ENDMARKER), string='')

(Note that for the sake of readability, I’ve omitted a few columns from the result above — metadata like starting index, ending index, a copy of the line on which a token occurs, etc.)

#code quality #code review #static analysis #static code analysis #code analysis #static analysis tools #code review tips #static code analyzer #static code analysis tool #static analyzer

Samanta  Moore

Samanta Moore

1621137960

Guidelines for Java Code Reviews

Get a jump-start on your next code review session with this list.

Having another pair of eyes scan your code is always useful and helps you spot mistakes before you break production. You need not be an expert to review someone’s code. Some experience with the programming language and a review checklist should help you get started. We’ve put together a list of things you should keep in mind when you’re reviewing Java code. Read on!

1. Follow Java Code Conventions

2. Replace Imperative Code With Lambdas and Streams

3. Beware of the NullPointerException

4. Directly Assigning References From Client Code to a Field

5. Handle Exceptions With Care

#java #code quality #java tutorial #code analysis #code reviews #code review tips #code analysis tools #java tutorial for beginners #java code review