Skip to content

FluentD installation on linux vm

Step 1:- Install the fluentD package5 using following command.

$ curl -fsSL https://toolbelt.treasuredata.com/sh/install-redhat-fluent-package5-lts.sh | sh

Step 2:- Then we need to start the agent using following command

$ sudo systemctl start fluentd.service

You can also check the status of agent and restart the agent using following commands

$ sudo systemctl status fluentd.service
$ sudo systemctl restart fluentd.service

Step 3:- After agent installation we need to update the .conf file for path for logs and destination. Please refer the following path for .conf file updation.

/etc/fluent/fluentd.conf

Step 4:- Update the conf file path and destination for the targeted eventhub.

<source>
  @type tail
  tag mulelogs
  # mule app logs location, multiple locations can be added
  path /opt/mule/mule-en*/logs/*
  #position file location
  pos_file /var/log/fluent/mule-logs.pos
  read_from_head true
<parse>
    @type none
</parse>
</source>

<match mulelogs>
  @type copy
<store>
    @type kafka2
    # list of seed brokers, port 9093 is used by Kafka
    # add the event hub namespace as broker
    brokers evhn-cl-t0-inspt-ceus-510.servicebus.windows.net:9093
    use_event_time true
    # buffer settings
<buffer>
      @type file
      # location to store the logs chunks temporarily
      path var/log/fluent/buffer/td
      flush_interval 5s
      flush_thread_count 2
      chunk_limit_size 1M
</buffer>
    # topic settings
    # event hub name inside the event hub namespace
    default_topic application-logs
<format>
      @type json
</format>
    # producer settings
    max_send_retries 1
    required_acks -1
    # using default OS certs for SSL
    ssl_ca_certs_from_system true
    # username and password for event hub namespace
    username ************
    password ************

</store>
<store>
    @type stdout
</store>
</match>

Step 5:- Restart the fluentD with the command

$ sudo systemctl restart fluentd.service

Step 6:- After that check the logs are showing in the eventhub matrix and then in the respective log analytics workspace.