mtdl9 / vim-log-highlighting Goto Github PK
View Code? Open in Web Editor NEWSyntax highlighting for generic log files in VIM
License: MIT License
Syntax highlighting for generic log files in VIM
License: MIT License
with a 1MB log file(7000 lines) it took 1 minute to open, is this normal?
Hi,
I use your great plugin.
But little bug don't show correctly the colors
Ex:
msg:'test test'
work great
but
msg:'tests test'
not show the right color after the first word 'tests'
If a word end with a 's' color is interupted
What can we do?
Add a special entity and highlighting rules for filesize markers, for example:
40000K
12k
64MB
32M
2 GB
4 GiB
3111 MB/s
Hi! Thanks for this. I have a suggestion - I'm used to using ccze as a command line syntax highlighting post processor - i.e. 'cat /var/log/syslog |ccze -A'
It does some things I really like that I'd love to see in your plugin. Maybe you can get some inspiration from their highlighting rules. If I have some time, I may work on this myself.
You can see the ccze syntax highlighting rules here: https://github.com/cornet/ccze/blob/da40b194db910de610faccbabe559ed79c0b4411/src/ccze-color.c
Thanks again!
On Linux systems the syslog/messages format is commonly used in several system logs under /var/log.
This log format has five main sections:
Special rules should be added to highlight the host-name, program and process number sections.
Example of log data
Apr 3 07:40:01 HOSTNAME anacron[1111]: Job `cron.weekly' started
Apr 3 07:40:02 HOSTNAME rsyslogd: [origin software="rsyslogd"]
Add a custom ALE checker, defined when the plugin is loaded and ALE is installed on the local VIM, that will mark all errors and warnings in the log file (using the error and warning keywords) and populate the location list.
This will allow displaying all the errors and jumping to them quickly using the location list functions/keybindings.
Might require converting the syn keyword
definitions used for log levels into configurable variables.
RFC 3339 dates and times are not highlighted correctly, and some ISO 8601 formats aren't, either.
Examples of issues in vim-log-highlighting_test.log, shown in the screenshot below:
Please add a tag to package managers can easily grab without forking.
tag=v1.0
git tag $tag -m "$tag" && git push --tags
Add highlighting for version strings, for example:
0.1.3
2.7.5-1
0.2.1-2system3
v3.1.9
2.11.1-11-generic
1.1.0-1system1~1.01.1
Add a special entity and highlighting rules for time units, for example:
1ms
30s
12.1 s
3m
1d 2h 9m
XML highlighting does not work correctly for tags that use single quotes instead of double quotes when specifying attributes.
This example is highlighted properly:
<element attr="value">
While this example is not:
<element attr='value'>
Hi,
Thanks for this awesome work, I truly liked it. The problem is all log levels in my logs are highlighted with the same color. I tried to change in the log.vim but without success.
The columns in my logs are :
java-prod-agent - 09 17:51:58 ERROR [class] ............
ERROR, INFO, WARN, all have the same color.
Thanks.
Issue moved from sheerun/vim-polyglot#510
Does this bug happen when you install plugin without vim-polyglot?
No, it's the vim-polyglot syntax files.
Describe the bug:
Working with log files that contain json-encoded data, some of it rather long. When syntax highlighting is enabled, the following line (burried in a long log file) causes vim to sit at 100% utilization for more than a minute on vim7, and two seconds on vim8.
# the following line has 1220 byte string for data
I, [2020-07-08T14:41:34.438343 #15] INFO -- service: { rc: 1220, errno: 0, data: '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' }
syntime report under vim8 with just that line:
TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN
2.750524 9 0 2.750508 0.305614 logXmlEntity \&\w\+;
0.000460 9 0 0.000447 0.000051 logDate \(\(Mon\|Tue\|Wed\|Thu\|Fri\|Sat\|Sun\) \)\?\(Jan\|Feb\|Mar\|Ap
0.000221 1 0 0.000221 0.000221 logSysColumns \w\(\w\|\.\|-\)\+ \(\w\|\.\|-\)\+\(\[\d\+\]\)\?:
0.000160 9 0 0.000157 0.000018 logUUID \w\{8}-\w\{4}-\w\{4}-\w\{4}-\w\{12}
0.000134 22 13 0.000110 0.000006 logFloatNumber \<\d.\d\+[eE]\?\>
0.000133 27 19 0.000117 0.000005 logOperator [;,\?\:\.\<=\>\~\/\@\&\!$\%\&\+\-\|\^(){}\*#]
0.000131 12 3 0.000117 0.000011 logDate \d\{2,4}[-\/]\(\d\{2}\|Jan\|Feb\|Mar\|Apr\|May\|Jun\|Jul\|Aug\|
0.000099 15 6 0.000093 0.000007 logHexNumber \<\d\x\+\>
0.000097 17 8 0.000086 0.000006 logNumber \<-\?\d\+\>
0.000080 1 0 0.000080 0.000080 logTimeZone \d\{4} [A-Z]\{2,5}\>
0.000075 9 0 0.000060 0.000008 logDomain \v(^|\s)(\w|-)+(\.(\w|-)+)+\s
0.000071 13 4 0.000052 0.000005 logTime \d\{2}:\d\{2}:\d\{2}\(\.\d\{2,6}\)\?\(\s\?[-+]\d\{2,4}\|Z\)\?\>
0.000058 9 0 0.000050 0.000006 logMD5 \<[a-z0-9]\{32}\>
0.000057 9 0 0.000054 0.000006 logIPV6 \<\x\{1,4}\(:\x\{1,4}\)\{7}\>
0.000054 9 0 0.000049 0.000006 logFilePath [^a-zA-Z0-9"']\@<=\/\w[^\n|,; ()'"\]{}]\+
0.000051 9 0 0.000049 0.000006 logHexNumber \<0[xX]\x\+\>
0.000051 9 0 0.000050 0.000006 logBinaryNumber \<0[bB][01]\+\>
0.000047 9 0 0.000045 0.000005 logIPV4 \<\d\{1,3}\(\.\d\{1,3}\)\{3}\>
0.000047 9 0 0.000043 0.000005 logMacAddress \<\x\{2}\(:\x\{2}\)\{5}
0.000046 9 0 0.000043 0.000005 logFilePath \<\w:\\[^\n|,; ()'"\]{}]\+
0.000035 13 4 0.000030 0.000003 logBrackets [\[\]]
0.000024 1 1 0.000024 0.000024 logString $
0.000015 26 17 0.000002 0.000001 logString '\(s \|t \| \w\)\@!
0.000008 9 0 0.000002 0.000001 IndentLineSpace ^\s\+
0.000006 9 0 0.000004 0.000001 logEmptyLines -\{3,}
0.000005 9 0 0.000004 0.000001 logEmptyLines - -
0.000005 9 0 0.000004 0.000001 logString "
0.000005 9 0 0.000004 0.000001 logXmlDoctype <!DOCTYPE[^>]*>
0.000005 9 0 0.000003 0.000001 logXmlComment <!--
0.000005 9 0 0.000005 0.000001 logXmlCData <!\[CDATA\[.*\]\]>
0.000004 9 0 0.000004 0.000000 logEmptyLines \*\{3,}
0.000004 1 1 0.000004 0.000004 logString '
0.000004 9 0 0.000003 0.000000 logXmlHeader <?\(\w\|-\)\+\(\s\+\w\+\(="[^"]*"\|='[^']*'\)\?\)*?>
0.000004 9 0 0.000003 0.000000 logXmlTag <\/\?\(\(\w\|-\)\+:\)\?\(\w\|-\)\+\(\(\n\|\s\)\+\(\(\w\|-\)\+:\
0.000003 9 0 0.000003 0.000000 logEmptyLines =\{3,}
0.000003 1 0 0.000003 0.000003 logString \\.
0.000003 1 0 0.000003 0.000003 logString s
0.000003 1 1 0.000003 0.000003 logTimeZone [A-Z]\{2,5}\>\( \d\{4}\)\?
0.000003 9 0 0.000003 0.000000 logUrl http[s]\?:\/\/[^\n|,; '"]\+
0.000002 9 0 0.000001 0.000000 logDate ^20\d\{6}
2.752742 377
To Reproduce:
test.log
vim test.log
Add highlighting rules for email addresses. It would probably be helpful to highlight them differently from URLs and file paths.
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.