Giter Club home page Giter Club logo

wildfly-logstash's People

Contributors

apophizzz avatar dependabot[bot] avatar jbeck123 avatar kifj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

wildfly-logstash's Issues

Log file delivery after network failure

Hello,

I've noticed that locally saved json data is not delivered to logstash collector after long network outage.
Is it my configuration problem or stale logs should be uploaded manually or with external tools?
Thanks in advance!

/subsystem=logging/custom-formatter=LOGSTASH-PATTERN:add(class=net.logstash.logging.formatter.LogstashUtilFormatter,module=net.logstash.logging)
/subsystem=logging/periodic-rotating-file-handler=LOGSTASH:add(autoflush=true,suffix=".yyyy-MM-dd",append=true,file={path=logstash.log, relative-to=jboss.server.log.dir})
/subsystem=logging/periodic-rotating-file-handler=LOGSTASH:write-attribute(name=named-formatter,value=LOGSTASH-PATTERN)
/subsystem=logging/custom-handler=LOGSTASH-SOCKET:add(level=DEBUG,class=net.logstash.logging.handler.SocketHandler,module=net.logstash.logging,named-formatter=LOGSTASH-PATTERN,properties={protocol=TCP,hostname=collector.localnet,port=9200,subHandler=LOGSTASH})
/subsystem=logging/async-handler=LOGSTASH-ASYNC:add(queue-length=512, subhandlers=[LOGSTASH-SOCKET])
/subsystem=logging/root-logger=ROOT:add-handler(name=LOGSTASH-ASYNC)

No tcp reconnection when starting logstash while starting wildfly

I have ELK stack in docker and an image with wildfly which runs an application that takes time to start up. The problem I found is when you start wildfly container and logstash a bit later logs are never sent. After debbuging the module I found out the problem lies in the initialize method:

final OutputStream out = createOutputStream();
if (out == null) { <-- here
    return;
}
final String encoding = getEncoding();
final UninterruptibleOutputStream outputStream = new UninterruptibleOutputStream(out);
writer = new OutputStreamWriter(outputStream, (encoding != null) ? encoding : "UTF-8");
writeHead(writer);

method createOutputStream returns null if TcpOutpuStream is not connected. That results in not creating writer in the code above, but without throwing any exception doPublish method walks in the condition below, sets the initialize flag to false and never tries again to initialize writer:

if (initialize && (em.lastExceptionTimestamp < System.currentTimeMillis() - 5000)) {
  initialize();
  if (em.lastException == null) {
    initialize = false;
  }
}

I could work-around this with throwing an exception in the createOutputStream method if the output stream is not connected - after that everything works okay:

  private OutputStream createOutputStream() {
    if (address == null) {
      setHostname(hostName);
    }

    if (address != null || port >= 0) {
      try {
        switch (protocol) {
        case SSL_TCP:
          SslTcpOutputStream sos = new SslTcpOutputStream(address, port);
          if (sos.isConnected()) {
            return sos;
          }
          break;
        case UDP:
          return new UdpOutputStream(address, port);
        case TCP:
        default:
          TcpOutputStream tos = new TcpOutputStream(address, port);
          if (tos.isConnected()) {
            return tos;
          }
// this sets last exception in em and connects after a while correctly
          throw new UnknownHostException("could not connect to address: " + address); 
//          break;
        }
      } catch (IOException e) {
        reportError("Failed to create socket output stream", e, ErrorManager.OPEN_FAILURE);
      }
    }
    return null;
  }

Documentation does not work with ELK 8.0.1

Feedback via eMail: we are using Wildfly 23.0.2.Final and ELK 8.0.1, and the README seems to be out of date:

  1. type in input and file must be the same?
  2. format => "json_event" must is now codec => "json"
  3. files still not being visible in Kibana. Wildfy runs on Windows, and logstash in docker

input {
file {
type => "wildfly-server"
path => "/mnt/log/logstash.log"
codec => "json"
}
}

filter {
if [type] == "wildfly-server" {
json {
source => "message"
}
}
}

output {
elasticsearch {
hosts => "elasticsearch:9200"
user => "logstash_internal"
password => "${LOGSTASH_INTERNAL_PASSWORD}"
}
}

JDK7 support

Hello,

you have wrote a very useful thing, thanks! Maintaining logstash forwarder for each WF instance is a real pain on big traffic.

Can I ask for JDK7 build support?
My 8.x WF is build on 7th java and currently I have not possibility to upgrade.
Thanks!

readme not accurate

to create a zip file you'll have to start maven with zip profile:

mvn package -P zip

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.