Giter Club home page Giter Club logo

Comments (3)

svetob avatar svetob commented on July 21, 2024

Hmm, are you using the latest version 0.1.2? There was a bugfix in it to fix an issue causing logs to not appearing in logstash. But this looks like it could potentially be a different issue.

from logstash-json.

rdesgrange-lf avatar rdesgrange-lf commented on July 21, 2024

Hum I append this in my mix.exs :

defp deps do
  [{:logstash, github: "svetob/logstash-json"}]
end

So I think it's using master ?

from logstash-json.

svetob avatar svetob commented on July 21, 2024

Tested this locally now.

Started logstash using the command from the first post:

docker run --rm -ti -p 5001:5001 logstash:2.3 logstash --debug -e 'input { tcp {codec => json port => "5001"} } output { stdout { } }'

Configuring logstash-json version 0.3.0 to connect to port 5001:

use Mix.Config

config :logger,
  backends: [
    {LogstashJson.TCP, :logstash},
    {LogstashJson.Console, :json}
  ]

config :logger, :logstash,
  level: :debug,
  host: System.get_env("LOGSTASH_TCP_HOST") || "localhost",
  port: System.get_env("LOGSTASH_TCP_PORT") || "5001",
  fields: %{appid: "logstash-json"}

config :logger, :json,
  level: :info

Starting with iex -S mix, logstash accepts connection:

Accepted connection {:client=>"172.17.0.1:59212", :server=>"0.0.0.0:5001", :level=>:debug, :file=>"logstash/inputs/tcp.rb", :line=>"142", :method=>"server_connection_thread"}
config LogStash::Codecs::JSONLines/@charset = "UTF-8" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::JSONLines/@delimiter = "\n" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
Pushing flush onto pipeline {:level=>:debug, :file=>"logstash/pipeline.rb", :line=>"458", :method=>"flush"}

Sending a log message:

iex(2)> Logger.info "hi"
{"module":null,"metadata":null,"message":"hi","line":2,"level":"info","function":null,"@timestamp":"2016-09-19T20:54:39.213+02:00"}
:ok

Logstash receives the message:

filter received {:event=>{"module"=>nil, "metadata"=>[], "message"=>"hi", "line"=>2, "level"=>"info", "function"=>nil, "appid"=>"logstash-json", "@timestamp"=>"2016-09-19T18:54:39.213Z", "@version"=>"1", "host"=>"172.17.0.1", "port"=>59212}, :level=>:debug, :file=>"(eval)", :line=>"18", :method=>"filter_func"}
output received {:event=>{"module"=>nil, "metadata"=>[], "message"=>"hi", "line"=>2, "level"=>"info", "function"=>nil, "appid"=>"logstash-json", "@timestamp"=>"2016-09-19T18:54:39.213Z", "@version"=>"1", "host"=>"172.17.0.1", "port"=>59212}, :level=>:debug, :file=>"(eval)", :line=>"23", :method=>"output_func"}
2016-09-19T18:54:39.213Z 172.17.0.1 hi

It seems that with 0.3.0 there are no errors, either that or I am not able to reproduce this issue locally. @rdesgrange-lf if with {:logstash_json, "~> 0.3.0"} you are still getting errors, please post a copy of the errors from the logstash output here.

from logstash-json.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.