Giter Club home page Giter Club logo

websocket-tail-demo's Introduction

在Linux操作系统中,经常需要查看日志文件的实时输出内容,通常会使用tail -f或者tailf命令。查看实时日志可能会需要首先SSH连上Linux主机,步骤很麻烦不说,如果是生产环境的服务器,可能还会控制各种权限。此时可以考虑基于Web显示实时日志。

由于传统的HTTP协议是请求/响应模式,而实时日志需要不定时的持续的输出,有新的日志内容时需要由服务器主动推送给客户端浏览器。所以这里使用的是HTML5的WebSocket协议。

按照惯例,先上图: Web实时日志

Getting Started

在Linux下用Maven Jetty插件运行Demo:

git clone https://github.com/wucao/websocket-tail-demo.git
cd websocket-tail-demo
mvn jetty:run

成功后可以在http://localhost:8080/查看实时日志。

部署

可以将项目部署在支持JSR 356的服务器,例如Tomcat、Jetty的最新版本。由于用到tail命令,该项目需要部署在Linux系统上。

websocket-tail-demo's People

Contributors

wucao avatar

Watchers

 avatar

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.