pvdb / ntail Goto Github PK
View Code? Open in Web Editor NEWA tail(1)-like utility for nginx log files that supports parsing, filtering and formatting individual log lines.
License: MIT License
A tail(1)-like utility for nginx log files that supports parsing, filtering and formatting individual log lines.
License: MIT License
By using the new "complex formatting" feature in Ruby 1.9, we can significantly improve the built-in support for formatted output.
By implementing the to_hash
method on each log line, we could replace something like this:
puts [remote_addr, http_user_agent].join(' => ')
... with something like this:
puts "%{remote_addr} => %{http_user_agent}" % self.to_hash
... or even override the puts
method on log line instances, and make the hash implicit in the DSL:
puts "%{remote_addr} => %{http_user_agent}"
/cc @jspc
Hi,
Is there a way to filter log within a date range ?
Thanks !
Production use of ntail
often requires filtering on URI query params, which at the moment isn't very well supported out of the box.
Given a log line with the following uri
part of the request
component:
/index?qux=blegga&foo=bar
Using the DSL, building a filter on any of the URI query params cannot be more sophisticated then:
-f "uri =~ /blegga/"
Unless you resort to something like:
-f "CGI::parse(URI::parse(uri).query)['qux'] == 'blegga'"
It would be much easier/nicer if ntail
implemented this out-of-the-box, something along the lines of:
-f "uri_query_params['qux'] == 'blegga'"
The following StackOverflow post contains a number of viable alternatives for implementing this ntail
feature:
/cc @jspc
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.