Labeled Tab-separated Values (LTSV)
Time 2022-08-09 03:04:10Web Name: Labeled Tab-separated Values (LTSV)
WebSite: http://www.ltsv.org
ID:275025
Keywords:
Tab,Labeled,separated,LTSVDescription:
Labeled Tab-separated Values
Description
Labeled Tab-separated Values (LTSV) format is a variant ofTab-separated Values (TSV). Each record in a LTSV file is represented asa single line. Each field is separated by TAB and has a label and avalue. The label and the value have been separated by ':'.With the LTSV format, you can parse each line by spliting with TAB(like original TSV format) easily, and extend any fields withunique labels in no particular order.
FAQ
Follow the link.Example
The LTSV format originally focuses on access logs of web servers, so I'll show an access log of traditional Combined Log Format and the same log of LTSV format version as examples.
The configuration of traditional Combined Log Format on Apache is:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
and access log will look like: (ref. http://httpd.apache.org/docs/2.2/logs.html)
127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"
The configuration of LTSV format with the same infomation will be:
LogFormat "host:%h\tident:%l\tuser:%u\ttime:%t\treq:%r\tstatus:%>s\tsize:%b\treferer:\%{Referer}i\tua:%{User-Agent}i" combined_ltsv
then the access log will be like:
host:127.0.0.1<TAB>ident:-<TAB>user:frank<TAB>time:[10/Oct/2000:13:55:36 -0700]<TAB>req:GET /apache_pb.gif HTTP/1.0<TAB>status:200<TAB>size:2326<TAB>referer:http://www.example.com/start.html<TAB>ua:Mozilla/4.08 [en] (Win98; I ;Nav)
Here is a simple LTSV parser:
#!/usr/bin/env rubywhile gets record = Hash[$_.split("\t").map{|f| f.split(":", 2)}] p recordend
With this parser, you will get the hash like:
{"host"=>"127.0.0.1", "ident"=>"-", "user"=>"frank", "time"=>"[10/Oct/2000:13:55:36 -0700]", "req"=>"GET /apache_pb.gif HTTP/1.0", "status"=>"200", "size"=>"2326", "referer"=>"http://www.example.com/start.html", "ua"=>"Mozilla/4.08 [en] (Win98; I ;Nav)\n"}
Definition
A LTSV file must be a byte sequence whichmatches the ltsv
production in the following ABNF:
ltsv = *(record NL) [record]record = [field *(TAB field)]field = label ":" field-valuelabel = 1*lbytefield-value = *fbyteTAB = %x09NL = [%x0D] %x0Albyte = %x30-39 / %x41-5A / %x61-7A / "_" / "." / "-" ;; [0-9A-Za-z_.-]fbyte = %x01-08 / %x0B / %x0C / %x0E-FF
Recommendations for labeling
The specification of LTSV is simple and primitive. Nevertheless label standardization may help to improve reusability of some implementations for processing or analysis.
Labels for Web server's Log
Here are labeling recommendations, their descriptions, format strings for apache and ones for nginx.
A LogFormat example for Apache mod_log_config.
LogFormat "time:%t\tforwardedfor:%{X-Forwarded-For}i\thost:%h\treq:%r\tstatus:%>s\tsize:%B\treferer:%{Referer}i\tua:%{User-Agent}i\treqtime_microsec:%D\tcache:%{X-Cache}o\truntime:%{X-Runtime}o\tvhost:%{Host}i" ltsv
A log_format example for nginx.
log_format ltsv "time:$time_local" "\thost:$remote_addr" "\tforwardedfor:$http_x_forwarded_for" "\treq:$request" "\tstatus:$status" "\tsize:$body_bytes_sent" "\treferer:$http_referer" "\tua:$http_user_agent" "\treqtime:$request_time" "\tcache:$upstream_http_x_cache" "\truntime:$upstream_http_x_runtime" "\tvhost:$host";
Tools supporting LTSV
fluentd
fluentd (http://fluentd.org/) supports to parse a LTSV file with in_tail plugin.The configuration is like this:
<source> type tail format ltsv time_format %d/%b/%Y:%H:%M:%S %z path /var/log/nginx/access_log pos_file /var/log/nginx/access_log.pos tag nginx.access</source>
plugins for fluentd
fluent-plugin-parserhttp://rubygems.org/gems/fluent-plugin-parserfluent-mixin-plaintextformatterhttps://rubygems.org/gems/fluent-mixin-plaintextformatterltsview
A viewer for LTSV. This tool includes the LTSV parser.https://metacpan.org/module/Text::LTSVPlack::Middleware::AxsLog
Plack::Middleware::AxsLog ( Fixed format but Fast AccessLog Middleware ) supports LTSV.https://metacpan.org/module/Plack::Middleware::AxsLogcombined2ltsv.pl
converts (common|combined) log to LTSV (ref. author's blog entry in Japanese.)http://colabv6.dan.co.jp/ltsv/combined2ltsv.plMCombined2LTSV.java
converts (common|combined) log to LTSV. Implemented in Java (ref. author's blog entry in Japanese.)https://github.com/Kanatoko/MCP/blob/master/src/net/jumperz/io/multicore/example/MCombined2LTSV.javaParser Implementations
Perl
Text::LTSV (including ltsview, a viewer for LTSV)https://metacpan.org/module/Text::LTSVRuby
ltsvhttps://rubygems.org/gems/ltsvPython
ltsvhttp://pypi.python.org/pypi/ltsvPHP
php-ltsvhttps://github.com/tienlen/php-ltsvphp-ltsv (yet another)https://github.com/t-cyrill/php-ltsvText-LTSVhttps://github.com/hiroy/clover-text-ltsvText_LTSVhttps://github.com/tkmsaoi/Text_LTSVJava
ltsv4jhttps://github.com/making/ltsv4jD
ltsv-dhttps://github.com/repeatedly/ltsv-dDart
ltsv.darthttps://gist.github.com/tomotaka/4736681Emacs Lisp
emacs-ltsvhttps://github.com/syohex/emacs-ltsvScheme
ltsv.scmhttps://gist.github.com/bizenn/4737619node.js
ltsvhttps://npmjs.org/package/ltsvltsv-streamhttps://npmjs.org/package/ltsv-streamErlang
erlang-ltsvhttps://github.com/shirou/erlang-ltsvC#
DynamicLTSVhttps://github.com/masaru-b-cl/DynamicLTSVLTSV.NEThttps://github.com/ne-sachirou/LTSV.NETGo
goltsvhttps://github.com/ymotongpoo/goltsvltsvhttps://github.com/najeira/ltsvgo-ltsvhttps://github.com/Songmu/go-ltsvClojure
ltsv.cljhttps://gist.github.com/emasaka/4745302Scala
ltsv4shttps://github.com/seratch/ltsv4sbash / ksh
ltsv.shhttps://github.com/fumiyas/ltsv.shVim
ltsv.vimhttps://gist.github.com/mattn/4737234Text.LTSV module (vital.vim)https://github.com/vim-jp/vital.vimC89
ltsv4chttps://github.com/9re/ltsv4cc-ltsviewhttps://github.com/DQNEO/c-ltsviewApache Pig
pig-ltsv-storagehttps://bitbucket.org/miyakawa_taku/pig-ltsv-storage/Apache Hive
KeyValuePairsDeserializerhttps://github.com/hatena/KeyValuePairsDeserializerTAGS:Tab Labeled separated LTSV
<<< Thank you for your visit >>>
Websites to related : PropsBMX Box Set Database Search
Photo & video © Props BMX 2020 - Created by partsformy.bike PDF
Business Leadership Roundtable:root{--color_0:255,255,255;--color_27:167,242,222;--color_1:255,255,255;--color_2:0,0,0;--color_3:237,28,36;--color_4:0,136,203;--col
GBVDB - Guided By Voices DatabasDiscographyArtistsGuided By VoicesRobert PollardCub Scout Bowling PinsCash Rivers And The SinnersESP OhioDoug Gillard|Kevin MarchMark Shue|Bobby Bare
Attaboy.ca · Luke Andrews · DeWild Rice, Dried Vegetables, Dri
The store will not work correctly in the case when cookies are disabled. JavaScript see
Readerware - Music, Video & BookOrder Books DatabaseOrder Music DatabaseOrder Video DatabaseOrder 3 Product BundleOrder UpgradesBarcode ReadersNew in Readerware 4OverviewBooks Databa
Khatabook - Manage your BusinessWe're here for your businessAs the world moves online, we at Khatabook are making sure the small and medium businesses are part of this digital
InstabaseMarque belge de tables et chaise
arrow/backward@2xarrow/rightarrow/down@2xarrow/foward@2xarrow/left@2xarrow/right@2xarrow/up@2xGroup 3icon/infos copy?icon/infosGroup 5icon
Los Viajeros Inn - Comfortable Hads
Hot Websites