Skip to content

Latest commit

 

History

History
79 lines (59 loc) · 1.85 KB

README.md

File metadata and controls

79 lines (59 loc) · 1.85 KB

Logflare Agent

About

This Elixir app watches a file and sends new lines to Logflare via the API.

Usage

To install stand alone:

  • Install Erlang
  • Install Elixir
  • git clone https://github.com/Logflare/logflare-agent.git
  • mix deps.get

Configure it.

mix release

_build/dev/rel/logflare_agent/bin/logflare_agent start

Optionally to start the agent at bootup:

crontab -e

Add this line to your crontab and save:

@reboot /FULL_PATH_TO_INSTALL/_build/dev/rel/logflare_agent/bin/logflare_agent start

Configure

Change the file to watch and the source key in ./config/config.exs

config :logflare_agent,
  sources: [
    %{
      path: "/home/logflare/app_release/logflare/var/log/erlang.log.1",
      source: "SOURCE_ID"
    },
    %{
      path: "/home/logflare/app_release/logflare/var/log/erlang.log.2",
      source: "SOURCE_ID"
    },
    %{
      path: "/home/logflare/app_release/logflare/var/log/erlang.log.3",
      source: "SOURCE_ID"
    },
    %{
      path: "/home/logflare/app_release/logflare/var/log/erlang.log.4",
      source: "SOURCE_ID"
    },
    %{
      path: "/home/logflare/app_release/logflare/var/log/erlang.log.5",
      source: "SOURCE_ID"
    }
  ],
  url: "https://api.logflare.app",
  api_key: "YOUR_API_KEY"

Your sources can be different with each file. This example is useful when watching Erlang log files.

Installation with Hex

If available in Hex, the package can be installed by adding logflare_agent to your list of dependencies in mix.exs:

def deps do
  [
    {:logflare_agent, "~> 0.6.2"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/logflare_agent.