Skip to content

Commit 94d08e9

Browse files
authored
Merge pull request #50 from itkovian/jsonify
Jsonify
2 parents 9e697a0 + ff91cd8 commit 94d08e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+927
-829
lines changed

Jenkinsfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env groovy
22

3-
def LOGSTASH_VERSION = "7.10.2"
3+
def VECTOR_VERSION = "0.37.1"
44

55
node {
66
stage('checkout git') {
@@ -9,13 +9,14 @@ node {
99
sh 'git clean -fxd'
1010
}
1111

12-
stage('install logstash') {
13-
sh "wget -nv https://artifacts.elastic.co/downloads/logstash/logstash-${LOGSTASH_VERSION}-linux-x86_64.tar.gz"
14-
sh "tar -xzf logstash-${LOGSTASH_VERSION}-linux-x86_64.tar.gz"
15-
env.PATH = "${pwd()}/logstash-${LOGSTASH_VERSION}/bin:${env.PATH}"
12+
stage('install vector') {
13+
sh "wget -nv https://packages.timber.io/vector/${VECTOR_VERSION}/vector-${VECTOR_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
14+
sh "tar -xzf vector-${VECTOR_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
15+
env.PATH = "${pwd()}/vector-x86_64-unknown-linux-gnu/bin/:${env.PATH}"
1616
}
1717

1818
stage('test') {
19+
sh 'python3.6 -V'
1920
sh 'pip3 install --ignore-installed --prefix $PWD/.vsc-tox tox'
2021
sh 'export PATH=$PWD/.vsc-tox/bin:$PATH && export PYTHONPATH=$PWD/.vsc-tox/lib/python$(python3 -c "import sys; print(\\"%s.%s\\" % sys.version_info[:2])")/site-packages:$PYTHONPATH && tox -v -c tox.ini'
2122
sh 'rm -r $PWD/.vsc-tox'

LICENSE

Lines changed: 502 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1-
# Logstash patterns
1+
# Grok patterns
22

33
Patterns for parsing and structuring log messages for different
4-
services with [Logstash](http://logstash.net).
4+
services with [Vector](http://vector.dev).
55

66
Use [this app](https://grokdebug.herokuapp.com/) for debugging your
77
patterns! Be careful, there might be subtle differences!
88

99
When issuing pull requests to this repository, don't forget to include an example of the messages your commits try to parse!!
1010

11+
## Adding pattern
1112

12-
# Adding pattern
13-
14-
Develop a new pattern typically in its own file, and call the main new pattern `<something>_MSG`.
15-
16-
Than you can do:
17-
* extend the `RSYSLOGMESSAGE` in the `rsyslog` file with a new pattern,
18-
by joining it with a `|` and placing the new pattern before the `GREEDYDATA` one.
19-
This requires only a new rpm and no configuration changes. This is very convient for
20-
testing.
21-
* add the new pattern to the list in the test configuration to the `grok`
22-
filter before the `RSYSLOGMESSAGE` as follows: `%{RSYSLOGPREFIX}%{<something>_MSG}`
23-
This requires a new rpm and configuration change in quattor too. Should only be done
24-
when a pattern is considered stable.
13+
Develop a new PATTERN typically in its own file, and call the main new pattern `<PATTERN>_MSG`.
2514

15+
Then you can:
16+
* Add the new message pattern to the Vector config file in the section `[transforms.syslog]`. Typically,
17+
you will add it to the top-level list of patterns to try (second argument of parse_groks).
18+
* Include the definitions for this grok pattern in its own JSON file `<PATTERN>.json`, in the format
19+
given by the existing JSON files. You will need to add this filename to the `vector.toml` config file
20+
under the parse_groks argument `alias_sources`.
21+
* Add tests for your pattern in `tests/<PATTERN>.toml`. Specify the input, and compose the VRL program that
22+
asserts the expected structured output.

files/ceph

Lines changed: 0 additions & 24 deletions
This file was deleted.

files/ceph.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"CEPH_BYTES": "%{NONNEGINT} (?:(?:k|M|G|T|P)?B)",
3+
"CEPH_MSG": "%{DATA} (?:%{CEPH_PGMAP}|%{CEPH_SLOW_REQUEST})",
4+
"CEPH_PGMAP": ".*? pgmap v(?<pgmapv>[0-9]+): %{NONNEGINT:ceph.pgs} pgs: (?:%{CEPH_PGMAP_DETAIL})(?:; %{CEPH_PGMAP_VOLUME})?(?:; %{CEPH_PGMAP_ACT})?(?:; %{CEPH_PGMAP_OBJ_DEGRADED})?(?:; %{CEPH_PGMAP_OBJ_MISPLACED})?(?:; %{CEPH_PGMAP_OBJ_RECOV})?$",
5+
"CEPH_PGMAP_ACT": "(%{CEPH_BYTES:ceph.actread}/s rd, )?(%{CEPH_BYTES:ceph.actwrite}/s wr, )?%{NONNEGINT:ceph.actops} op/s",
6+
"CEPH_PGMAP_DETAIL": "(?:%{CEPH_PGMAP_DETAIL_PAT}(?:, %{CEPH_PGMAP_DETAIL_PAT})*)",
7+
"CEPH_PGMAP_DETAIL_ACTIVE_CLEAN": "%{NONNEGINT:ceph.active_clean} active\\+clean",
8+
"CEPH_PGMAP_DETAIL_PAT": "(?:%{CEPH_PGMAP_DETAIL_ACTIVE_CLEAN}|%{CEPH_PGMAP_DETAIL_REST})",
9+
"CEPH_PGMAP_DETAIL_REST": "%{NONNEGINT} (?:[^ ,;]+)",
10+
"CEPH_PGMAP_OBJ_DEGRADED": "%{NONNEGINT:ceph.objdegraded}/%{NONNEGINT:ceph.objtotal} objects degraded [^;]*",
11+
"CEPH_PGMAP_OBJ_MISPLACED": "%{NONNEGINT:ceph.objmisplaced}/%{NONNEGINT:ceph.objtotal} objects misplaced [^;]*",
12+
"CEPH_PGMAP_OBJ_RECOV": "%{CEPH_BYTES:ceph.objrecovthr}/s, %{NONNEGINT:ceph.objrecovhz} objects/s recovering",
13+
"CEPH_PGMAP_VOLUME": "%{CEPH_BYTES:ceph.volumedata} data, %{CEPH_BYTES:ceph.volumeused} used, %{CEPH_BYTES:ceph.volumeavail} / %{CEPH_BYTES:ceph.volumetotal} avail",
14+
"CEPH_SLOW_REQUEST": ".*? (?<osd>osd.%{NONNEGINT}) .*? (?:%{CEPH_SLOW_REQUEST_SINGLE}|%{CEPH_SLOW_REQUEST_OLDEST}) %{CEPH_SLOW_REQUEST_SECONDS} (?:secs|seconds old)",
15+
"CEPH_SLOW_REQUEST_OLDEST": "%{NONNEGINT:ceph.slowrequestnumber} slow requests, .*? oldest blocked for .*?",
16+
"CEPH_SLOW_REQUEST_SECONDS": "(?<slowrequestseconds>%{NONNEGINT})(?:\\.%{NONNEGINT})?",
17+
"CEPH_SLOW_REQUEST_SINGLE": "slow request"
18+
}

files/gpfs

Lines changed: 0 additions & 3 deletions
This file was deleted.

files/gpfs.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"GPFSDATA": "%{GREEDYDATA}",
3+
"GPFSDATE": "%{DAY}%{SPACE}%{MONTH}%{SPACE}%{MONTHDAY}%{SPACE}%{TIME}%{SPACE}%{YEAR}",
4+
"GPFSLOG": "%{GPFSDATE:gpfs.timestamp}:%{SPACE}%{GPFSDATA:gpfs.realmsg}"
5+
}

files/grok-patterns

Lines changed: 0 additions & 103 deletions
This file was deleted.

files/grok-patterns.json

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
3+
"USERNAME": "[a-zA-Z0-9._-]+",
4+
"USER": "%{USERNAME}",
5+
"EMAILLOCALPART": "[a-zA-Z][a-zA-Z0-9_.+-=:]+",
6+
"EMAILADDRESS": "%{EMAILLOCALPART}@%{HOSTNAME}",
7+
"HTTPDUSER": "%{EMAILADDRESS}|%{USER}",
8+
"INT": "(?:[+-]?(?:[0-9]+))",
9+
"BASE10NUM": "(?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))",
10+
"NUMBER": "(?:%{BASE10NUM})",
11+
"BASE16NUM": "(?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))",
12+
"BASE16FLOAT": "\b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b",
13+
14+
"POSINT": "\b(?:[1-9][0-9]*)\b",
15+
"NONNEGINT": "\b(?:[0-9]+)\b",
16+
"WORD": "\b\w+\b",
17+
"NOTSPACE": "\S+",
18+
"SPACE": "\s*",
19+
"DATA": ".*?",
20+
"GREEDYDATA": ".*",
21+
"QUOTEDSTRING": "(?>(?<!\\)(?>"(?>\\.|[^\\"]+)+"|""|(?>'(?>\\.|[^\\']+)+')|''|(?>`(?>\\.|[^\\`]+)+`)|``))",
22+
"UUID": "[A-Fa-f0-9]{8}-(?:[A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}",
23+
24+
"MAC": "(?:%{CISCOMAC}|%{WINDOWSMAC}|%{COMMONMAC})",
25+
"CISCOMAC": "(?:(?:[A-Fa-f0-9]{4}\.){2}[A-Fa-f0-9]{4})",
26+
"WINDOWSMAC": "(?:(?:[A-Fa-f0-9]{2}-){5}[A-Fa-f0-9]{2})",
27+
"COMMONMAC": "(?:(?:[A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2})",
28+
"IPV6": "((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?",
29+
"IPV4": "(?<![0-9])(?:(?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]))(?![0-9])",
30+
"IP": "(?:%{IPV6}|%{IPV4})",
31+
"HOSTNAME": "\b(?:[0-9A-Za-z][0-9A-Za-z-]{0,62})(?:\.(?:[0-9A-Za-z][0-9A-Za-z-]{0,62}))*(\.?|\b)",
32+
"IPORHOST": "(?:%{IP}|%{HOSTNAME})",
33+
"HOSTPORT": "%{IPORHOST}:%{POSINT}",
34+
35+
"PATH": "(?:%{UNIXPATH}|%{WINPATH})",
36+
"UNIXPATH": "(/([\w_%!$@:.,~-]+|\\.)*)+",
37+
"TTY": "(?:/dev/(pts|tty([pq])?)(\w+)?/?(?:[0-9]+))",
38+
"WINPATH": "(?>[A-Za-z]+:|\\)(?:\\[^\\?*]*)+",
39+
"URIPROTO": "[A-Za-z]+(\+[A-Za-z+]+)?",
40+
"URIHOST": "%{IPORHOST}(?::%{POSINT:port})?",
41+
"URIPATH": "(?:/[A-Za-z0-9$.+!*'(){},~:;=@#%_\-]*)+",
42+
"#URIPARAM": "\?(?:[A-Za-z0-9]+(?:=(?:[^&]*))?(?:&(?:[A-Za-z0-9]+(?:=(?:[^&]*))?)?)*)?",
43+
"URIPARAM": "\?[A-Za-z0-9$.+!*'|(){},~@#%&/=:;_?\-\[\]<>]*",
44+
"URIPATHPARAM": "%{URIPATH}(?:%{URIPARAM})?",
45+
"URI": "%{URIPROTO}://(?:%{USER}(?::[^@]*)?@)?(?:%{URIHOST})?(?:%{URIPATHPARAM})?",
46+
47+
"MONTH": "\b(?:Jan(?:uary|uar)?|Feb(?:ruary|ruar)?|M(?:a|ä)?r(?:ch|z)?|Apr(?:il)?|Ma(?:y|i)?|Jun(?:e|i)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|O(?:c|k)?t(?:ober)?|Nov(?:ember)?|De(?:c|z)(?:ember)?)\b",
48+
"MONTHNUM": "(?:0?[1-9]|1[0-2])",
49+
"MONTHNUM2": "(?:0[1-9]|1[0-2])",
50+
"MONTHDAY": "(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9])",
51+
52+
"DAY": "(?:Mon(?:day)?|Tue(?:sday)?|Wed(?:nesday)?|Thu(?:rsday)?|Fri(?:day)?|Sat(?:urday)?|Sun(?:day)?)",
53+
54+
"YEAR": "(?>\d\d){1,2}",
55+
"HOUR": "(?:2[0123]|[01]?[0-9])",
56+
"MINUTE": "(?:[0-5][0-9])",
57+
"SECOND": "(?:(?:[0-5]?[0-9]|60)(?:[:.,][0-9]+)?)",
58+
"TIME": "(?!<[0-9])%{HOUR}:%{MINUTE}(?::%{SECOND})(?![0-9])",
59+
"DATE_US": "%{MONTHNUM}[/-]%{MONTHDAY}[/-]%{YEAR}",
60+
"DATE_EU": "%{MONTHDAY}[./-]%{MONTHNUM}[./-]%{YEAR}",
61+
"ISO8601_TIMEZONE": "(?:Z|[+-]%{HOUR}(?::?%{MINUTE}))",
62+
"ISO8601_SECOND": "(?:%{SECOND}|60)",
63+
"TIMESTAMP_ISO8601": "%{YEAR}-%{MONTHNUM}-%{MONTHDAY}[T ]%{HOUR}:?%{MINUTE}(?::?%{SECOND})?%{ISO8601_TIMEZONE}?",
64+
"DATE": "%{DATE_US}|%{DATE_EU}",
65+
"DATESTAMP": "%{DATE}[- ]%{TIME}",
66+
"TZ": "(?:[PMCE][SD]T|UTC)",
67+
"DATESTAMP_RFC822": "%{DAY} %{MONTH} %{MONTHDAY} %{YEAR} %{TIME} %{TZ}",
68+
"DATESTAMP_RFC2822": "%{DAY}, %{MONTHDAY} %{MONTH} %{YEAR} %{TIME} %{ISO8601_TIMEZONE}",
69+
"DATESTAMP_OTHER": "%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{TZ} %{YEAR}",
70+
"DATESTAMP_EVENTLOG": "%{YEAR}%{MONTHNUM2}%{MONTHDAY}%{HOUR}%{MINUTE}%{SECOND}",
71+
"HTTPDERROR_DATE": "%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}",
72+
73+
"SYSLOGTIMESTAMP": "%{MONTH} +%{MONTHDAY} %{TIME}",
74+
"PROG": "[\x21-\x5a\x5c\x5e-\x7e]+",
75+
"SYSLOGPROG": "%{PROG:program}(?:\[%{POSINT:pid}\])?",
76+
"SYSLOGHOST": "%{IPORHOST}",
77+
"SYSLOGFACILITY": "<%{NONNEGINT:facility}.%{NONNEGINT:priority}>",
78+
"HTTPDATE": "%{MONTHDAY}/%{MONTH}/%{YEAR}:%{TIME} %{INT}",
79+
80+
"QS": "%{QUOTEDSTRING}",
81+
82+
"SYSLOGBASE": "%{SYSLOGTIMESTAMP:timestamp} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:logsource} %{SYSLOGPROG}:",
83+
"COMMONAPACHELOG": "%{IPORHOST:clientip} %{HTTPDUSER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] \"(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})\" %{NUMBER:response} (?:%{NUMBER:bytes}|-)",
84+
"COMBINEDAPACHELOG": "%{COMMONAPACHELOG} %{QS:referrer} %{QS:agent}",
85+
"HTTPD20_ERRORLOG": "\[%{HTTPDERROR_DATE:timestamp}\] \[%{LOGLEVEL:loglevel}\] (?:\[client %{IPORHOST:clientip}\] ){0,1}%{GREEDYDATA:errormsg}",
86+
"HTTPD24_ERRORLOG": "\[%{HTTPDERROR_DATE:timestamp}\] \[%{WORD:module}:%{LOGLEVEL:loglevel}\] \[pid %{POSINT:pid}:tid %{NUMBER:tid}\]( \(%{POSINT:proxy_errorcode}\)%{DATA:proxy_errormessage}:)?( \[client %{IPORHOST:client}:%{POSINT:clientport}\])? %{DATA:errorcode}: %{GREEDYDATA:message}",
87+
"HTTPD_ERRORLOG": "%{HTTPD20_ERRORLOG}|%{HTTPD24_ERRORLOG}",
88+
89+
90+
"LOGLEVEL": "([Aa]lert|ALERT|[Tt]race|TRACE|[Dd]ebug|DEBUG|[Nn]otice|NOTICE|[Ii]nfo|INFO|[Ww]arn?(?:ing)?|WARN?(?:ING)?|[Ee]rr?(?:or)?|ERR?(?:OR)?|[Cc]rit?(?:ical)?|CRIT?(?:ICAL)?|[Ff]atal|FATAL|[Ss]evere|SEVERE|EMERG(?:ENCY)?|[Ee]merg(?:ency)?)"
91+
}

files/hpc-ugent-patterns

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)