Tuesday, August 16, 2016

Fluentd secure forwarding the logs

Following are the steps on FluentD server side:
·       Install fluentd secure forward plugin:
sudo /usr/sbin/td-agent-gem install fluent-plugin-secure-forward
·       Append following configuration in /etc/td-agent/td-agent.conf

<source>
  type secure_forward
  shared_key FLUENTD_SECRET
  self_hostname efk
  secure true
  ca_cert_path         /opt/ fluendconf /certificate/ca_cert.pem
  ca_private_key_path /opt/ fluendconf /certificate/ca_key.pem
  ca_private_key_passphrase passphrase_for_private_CA_secret_key
</source>

·       Generate CA certificate:
    cd /opt/td-agent/embedded/lib/ruby/gems/2.1.0/bin/     sudo ./secure-forward-ca-generate /opt/fluendconf/certificate/       passphrase_for_private_CA_secret_key
·       Restart the server
sudo service td-agent restart

Following are the steps on FluentD Agent side:

·       Install fluentd secure forward plugin:
sudo /usr/sbin/td-agent-gem install fluent-plugin-secure-forward

Append following configuration in /etc/td-agent/td-agent.conf
        <match **>
          type secure_forward
          shared_key FLUENTD_SECRET
          self_hostname ${hostname}
          secure true
          ca_cert_path /opt/ fluendconf /certificate/ca_cert.pem
         <server>
           host centralize_logging_server
         </server>
       </match>
Copy server’s ca_cert.pem file

               copy servers ca_cert.pem file to /opt/fluendconf/certificate/
Restart the server

       sudo service td-agent restart


Wednesday, August 10, 2016

Writing your own Dockerfile

mkdir My_Sample_Docker_Image

vi My_Sample_Docker_Image\Dockerfile
FROM ubuntu
RUN apt-get update
RUN apt-get install -y nginx
ENTRYPOINT [“/usr/sbin/nginx”,”-g”,”daemon off;”]
EXPOSE 80


Tuesday, August 9, 2016

Docker Cheatsheet

Docker Cheatsheet

Build Commands:

docker build -t myapp:1.0 .

This command will build your docker image from the Dockerfile in the current directory.

docker images

This command will list all images which are locally stored with Docker engine.

docker rmi myapp:1.0

This command will remove/Delete the stored image from Docker engine.


Ship Commands:

docker pull myapp:latest

This command will pull image from registry.

docker push myrepo/myapp:1.1

Run Commands:

docker run --rm remove container automatically after exit
                   -t connect the container to terminal 
                   -name test name the container
                   -p 5000:80 expose port no 5000 externally and map to port 80

docker stop test

Stop the running container with name test.

docker rm test

remove the stopped container with name test

docker exec -it test bash

Create a new bash process inside the container and connect it to the terminal.

docker logs --tail 100 test

Print last 100 line of container logs.



Terraform Cheat Sheet [WIP]

Installing Terraform