DevOps Classroom Series – 01/Oct/2021

Lab Setup

  • Basic Architecture Preview Preview

  • Elastic Search and Kibana Setup

    • Create a vm with at least 4GB of RAM
    • Install elastic search by following instructions Refer Here
    • To configure elastic search Refer Here Preview Preview Preview Preview Preview
    • Now lets install kibana Refer Here
    • Now lets work with kibana configuration Preview Preview
    • Now access kibana
  • Lets create an apache server and also install file beats to export the logs of apache to logstash

    • Create a free vm
    • Install apache2
    sudo apt update
    sudo apt install apache2 -y
    
  • Now create a configuration file to test whether the logs can be processed by logstash

input
{
    stdin {}
}
filter
{
    grok 
    {
        "match" => { "message" => "%{COMBINEDAPACHELOG}"}
    }
}
output 
{
    stdout {}
}
  • Now lets change the output in the configuration Refer Here
input
{
    stdin {}
}
filter
{
    grok 
    {
        "match" => { "message" => "%{COMBINEDAPACHELOG}"}
    }
}
output 
{
    elasticsearch
    {
        index => "apache-%{+yyyy.MM.dd}"
        hosts => "172.31.28.161"
    }
    
}
  • Now lets install beats, which can reads logs from local server and send it to the logstash.
    • For this we will be installing file beats Refer Here
    • Configure filebeats to read apache access logs Preview Preview Preview
  • Now we need to change the input of the conf to read from beats. Beats will forward the traffic to some port on logstash. Refer Here
input
{
    beats 
    {
        port => 5044
    }
}
filter
{
    grok 
    {
        "match" => { "message" => "%{COMBINEDAPACHELOG}"}
    }
}
output 
{
    elasticsearch
    {
        index => "apache-%{+yyyy.MM.dd}"
        hosts => "172.31.28.161"
    }
    
}
  • Next Steps:
    • We need to configure logstash to start automatically whenever the linux machine starts
    • We need to place the above configuration in a specific folder
    • Now we need to start beats, which exports the logs to logstash which add fields and stores in elastic search

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube