HUB
Sign inSign up
log-fluentd logo

labshare/log-fluentd

By labshare

•Updated over 7 years ago

Fluentd for LabShare Logger

Image
0

418

labshare/log-fluentd repository overview

⁠Docker EFK stack

Based on the official images:

Default configuration of Search Guard in this repo is:

  • Basic authentication required to access Elasticsearch/Kibana
  • HTTPS disabled
  • Hostname verification disabled
  • Self-signed SSL certificate for transport protocol (do not use in production)

Existing users:

  • admin (password: admin): No restrictions for this user, can do everything
  • fluentd (password: fluentd): CRUD permissions for fluentd index
  • kibanaro (password: kibanaro): Kibana user which can read every index
  • kibanaserver (password: kibanaserver): User for the Kibana server (all permissions for .kibana index)

⁠Requirements

⁠Increase vm.max_map_count on your host

You need to increase the vm.max_map_count kernel setting on your Docker host. To do this follow the recommended instructions from the Elastic documentation: Install Elasticsearch with Docker⁠

⁠Usage

Use EFK’s own nginx to create the nginx reverse-proxy setup rather than using docker-nginx-proxy There are two nginx templates for two different nginx-gens. Nginx-gen1 is for http and https and nginx-gen2 is for adding streaming to the nginx config file. Which template to use is decided by the Virtual Host and Port in docker-compose.yml i.e. {VIRTUAL_HOST1 and VIRTUAL_PORT1} or {VIRTUAL_HOST2 and VIRTUAL_PORT2}

When installing EFK on a new instance or changing the fluentd’s url, You will need to generate a letsencrypt certificate for it. This is generally done with having that url over port 80/443 rather than for streaming. So my work around for this was:

First create a fluentd container with VIRTUAL_HOST1 and VIRTUAL_PORT1 so as to let the letsencrypt be able to access it via https and create a certificate for it. Once the certificate is generated in the server, you stop and remove fluentd’s container, change docker-compose.yml to have { VIRTUAL_HOST2 and VIRTUAL_PORT2} and then relaunch the docker-compose.yml file.

This way you will then have the certificate for fluentd’s url. Once the fluentd’s certificate is generated, you need to go to it and copy the generated folder along with all the files into fluentd’s certs folder. This is for the other fluentd containers in client servers to verify main fluentd’s identity.

Deploy the fluetd in sender folder to all the client servers and direct all the container logs from the clients to their fluentd which will in turn encrypt them and send to the main fluentd.

Run launch.sh script to launch the EFK stack. Run remove.sh script to remove the EFK stack including it's volume.

##OLD USAGE BELOW:

Warning! Use the below just for information but not for starting the EFK stack. Follow what is inside the launch script if you want to know the actual startup commands.

Start the ELK stack using docker-compose: docker-compose up -d

⁠Important

Search Guard must be initialized after Elasticsearch is started:

$ docker exec elasticsearch bin/init_sg.sh

This executes sgadmin and load the configuration in elasticsearch/config/sg*.yml

Access Kibana UI by hitting http://localhost:5601⁠ with a web browser and use the following credentials to login:

  • user: kibanaro
  • password: kibanaro

Refer to the sg_internal_users.yml⁠ configuration file for a list of built-in users. And refer to [`sg_roles.yml and sg_roles_mapping.yml '] for the access levels of built-in users

By default, the stack exposes the following ports:

  • 24224: Fluentd TCP input.
  • 9200: Elasticsearch HTTP
  • 9300: Elasticsearch TCP transport
  • 5601: Kibana

⁠Configuration

NOTE: Configuration is not dynamically reloaded, you will need to restart the stack after any change in the configuration of a component.

⁠How can I tune Kibana configuration?

The Kibana default configuration is stored in kibana/config/kibana.yml.

⁠How can I tune Elasticsearch configuration?

The Elasticsearch container is using the shipped configuration⁠.

If you want to override the default configuration, create a file elasticsearch/config/elasticsearch.yml and add your configuration in it.

Then, you'll need to map your configuration file inside the container in the docker-compose.yml. Update the elasticsearch container declaration to:

elasticsearch:
  build: elasticsearch/
  volumes:
    - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml

You can also specify the options you want to override directly via environment variables:

⁠How can I add plugins?

To add plugins to any EFK component you have to:

  1. Add a RUN statement to the corresponding Dockerfile (eg. RUN logstash-plugin install logstash-filter-json)
  2. Add the associated plugin code configuration to the service configuration (eg. Logstash input/output)
Tag summary
Recent tags
Content type
Image
Digest
sha256:a283a00f2…
Size
63.1 MB
Last updated
over 4 years ago
docker pull labshare/log-fluentd:latest