DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Monitor Docker Swarm and Other Logs Using Filebeat, Logstash and AWS ES — Part 2

Monitor Docker Swarm and Other Logs Using Filebeat, Logstash and AWS ES — Part 2

Learn more about using this stack to collect and monitor Docker Swarm logs in your microservices architecture.

Arun Sharma user avatar by
Arun Sharma
·
Sep. 19, 18 · Tutorial
Like (1)
Save
Tweet
Share
6.58K Views

Join the DZone community and get the full member experience.

Join For Free

In my previous article, I described how to install Logstash and Filebeat on Ubuntu 16.04, along with the configuration of Logstash to send logs to AWS ES. The logs were sent to Logstash from Filebeat (from Docker Swarm nodes) and from other files, e.g. Jenkins logs, to Logstash as per Scenario 1.

If you have not gone through that article, I recommend you read it before reading this one because I will refer to it many times.

Scenario 2

  1. Send  Docker Swarm logs directly to AWS Elasticsearch from Filebeat.

  2. Send Jenkins logs to AWS Elasticsearch using Logstash.

Below diagram shows the flow of Scenario 2:

Image title

In this article, I am not going to narrate the installation part (refer to Part 1 for installation). I will just describe the configurations that need to be done to implement Scenario 2.

Logstash Config to Send Jenkins Logs to AWS ES

In this scenario, Logstash is just sending Jenkins logs to AWS ES so the configuration is very simple and straightforward.

/etc/logstash/conf.d/logstash.conf:

input {
    file{
        path => "/var/log/jenkins/jenkins.log"
        type => "jenkins"
   }
}

#filter {
#    grok {
#        match => { "source" => "%{GREEDYDATA}/%{GREEDYDATA:app}.log" }
#    }
#}

output {
    if [type] == "jenkins" {
      amazon_es{
        hosts => ["search-msdemo-logs-xfyuwloilsxmyn4ldgyzufundy.us-east-1.es.amazonaws.com"]
        region => "us-east-1"
        index => "jenkinslogs-%{+YYYY.MM.dd}"
      }
   }
}


Please refer to Part 1 to see how to install the amazon_es plugin, which will allow Logstash to connect to AWS ES.

Filebeat Config to Send Docker Swarm Logs to AWS ES

In this scenario, we are going to send Docker Swarm logs directly to AWS ES and Kibana from filebeat. Below is the filebeat.yml file configuration which will connect to AWS ES and Kibana.

filebeat.prospectors:
- type: log
  enabled: true
  paths:
    - '/var/lib/docker/containers/*/*.log'
  json.message_key: log
  json.keys_under_root: true
  processors:
   - add_docker_metadata: ~

setup.kibana:
  host: https://search-domainname-xksdfsdkjhfifwsffssuire.us-east-1.es.amazonaws.com/_plugin/kibana/

output.elasticsearch:
  hosts: ["https://search-domainname-xksdfsdkjhfifwsffssuire.us-east-1.es.amazonaws.com:443"]


You might have noticed that there is only one section which is not available, "output.logstash," in the filebeat.yml file. The only change you will notice is the "setup.kibana" and "output.elasticsearch" host configuration.

setup.kibana:
  host: https://search-domainname-xksdfsdkjhfifwsffssuire.us-east-1.es.amazonaws.com/_plugin/kibana/

output.elasticsearch:
  hosts: ["https://search-domainname-xksdfsdkjhfifwsffssuire.us-east-1.es.amazonaws.com:443"]


Both the hosts' links (Kibana and Elasticsearch) are available on the AWS ES dashboard. There is no security implemented while creating AWS ES services (Kibana and Elasticsearch) but it's highly recommended for any environment.

The links can be directly accessed from EC2 instances and logs are fed to the search see the screen below:

Image title

Once the above configurations are done, you are all set you see log messages in Kibana.

AWS Docker (software) Monitor (synchronization)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Create Spider Chart With ReactJS
  • Key Elements of Site Reliability Engineering (SRE)
  • Master Spring Boot 3 With GraalVM Native Image
  • Strategies for Kubernetes Cluster Administrators: Understanding Pod Scheduling

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: