Skip to content

Log Shippers

Using the FusionReactor agent, you can send additional logs hosted on your servers themselves with only minor configuration, however there are some drawbacks to this approach:

  • Sending logs using a process running within your application can reduce performance if there is a high volume of logs
  • Scraping logs does not allow you to apply custom labels to logs
  • To get the most value out of logging you also want to send logs from alternate servers.

Alternative sources could be:

  • Application server logs (e.g ColdFusion, Tomcat, Lucee)
  • Nginx logs
  • Database logs
  • IIS logs
  • Proxies
  • Docker logs

To send logs, you can use a logging client such as promtail, logback, fluentbit, fluentd or some other alternative.

You can send logs directly to FusionReactor Cloud by configuring the log destinations with the following URL, https://api.fusionreactor.io/logs/v1/ using basic authentication of username / password. Your username value will be your email used to login to FusionReactor Cloud, your password will be your API key.

To do this, you will need to generate an API key from FusionReactor Cloud.

Generating API keys

To generate an API key, go to your account settings page in FusionReactor Cloud Account Settings.

Under the API keys tab, click generate and create a key.

Labelling your logs

As you will see in the examples below, all logs must have at least a job label.

Recommended labels:

  • Job
  • Host
  • Filename (if applicable)

For more information see labels and fields

Logging Client examples

Below are examples of how to use promtail, fluentbit and logback to scrape logs from a container, we have updated the clients configuration to authenticate against FusionReactor Cloud.

Promtail

To install Promtail see the installation docs

promtail.yml example:

    server:
    http_listen_port: 9080
    grpc_listen_port: 0

    positions:
    filename: /tmp/positions.yaml

    clients:
    - url: https://api.fusionreactor.io/logs/v1/
      basic_auth:
      username: {user}
      password: {api key}

    scrape_configs:
    - job_name: nginx
      static_configs:
        - targets:
            - localhost
              labels:
              job: store-balancer
              host: localhost
              __path__: /var/log/nginx/*log

Fluent Bit

To install Fluent Bit see the install documentation.

fluent-bit.config example:

    [INPUT]
        Name        fusionreactor-logs
        Path        /opt/coldfusion2018/cfusion/logs/coldfusion-out.log
        Tag         cfusionout

    [INPUT]
        Name        fusionreactor-logs
        Path        /opt/coldfusion2018/cfusion/logs/coldfusion-error.log
        Tag         cfusionerr

    [OUTPUT]
        Name fusionreactor-logs
        Match cfusionout
        Url https://FR:your-api-key-here@api.fusionreactor.io/logs/v1/
        Labels {job="service-name-here",instance="hostname",filename="coldfusion-out.log"}
        LogLevel info

    [OUTPUT]
        Name fusionreactor-logs
        Match cfusionerr
        Url https://FR:your-api-key-here@api.fusionreactor.io/logs/v1/
        Labels {job="service-name-here",instance="hostname",filename="coldfusion-error.log"}
        LogLevel info

Logback

To add logback to your application see the download page

logback.xml example:

    <configuration>   
        <appender name="FRCLOUD" class="com.github.loki4j.logback.Loki4jAppender">
            <http>
                <url>https://api.fusionreactor.io/logs/v1/</url>
                <auth>
                    <username>{user}</username>
                    <password>{api key}</password>
                </auth>
            </http>
            <format>
                <label>
                    <pattern>job=${applicationName}</pattern>
                </label>
                <message>
                    <pattern>${applicationName} ${node.host}: [%-5level] %logger %mdc - %msg</pattern>
                </message>
                <sortByTime>true</sortByTime>
            </format>
        </appender>

        <appender name="FRCLOUD_ASYNC" class="ch.qos.logback.classic.AsyncAppender">
            <queueSize>500</queueSize>
            <discardingThreshold>0</discardingThreshold>
            <appender-ref ref="FRCLOUD" />
        </appender>

        <root level="INFO">
            <appender-ref ref="FRCLOUD_ASYNC"/>
        </root>

        <logger name="ROOT" level="INFO"/>
        <logger name="com.intergral" level="INFO"/>

    </configuration>