-
Notifications
You must be signed in to change notification settings - Fork 79
/
patterns.yml
1176 lines (1131 loc) · 38.9 KB
/
patterns.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# PARSER DEFINITIONS FILE IN YML FORMAT
#
# Please use 'ts' as feild name for dates and time
# RegexTools: https://regex101.com/#javascript
# Date format changes in date-fns:
# DEPRECATED date formats: https://date-fns.org/v2.0.0-alpha.6/docs/parse
# NEW date formats: https://date-fns.org/v2.9.0/docs/parse
# DD -> dd
# YYYY -> yyyy
# ZZ -> X
# Sensitive data can be replaced with a hashcode (sha1)
# it applies to fields matching the field names by a regular expression
# Note: this function is not optimized (yet) and might cause 10-15% performance hit
#autohash: !!js/regexp /user|client_ip|password|email|credit_card_number|payment_info/i
# set the hash function (default sha256), sha256,sha512
#hashFunction: sha512
debug: false
# set originalLine to false when auothash fields
# the original line might include sensitive data!
originalLine: false
# default seperator for multiline logs,
# which don't have a blockStart property
# The default /^\S{2,}/ would match typical stack traces
# All lines that start with a whitespace or contain only one char
# would be attached to previous lines
multiline:
defaultSeparator: ^\S{2,}
# post process all JSON input
json:
enabled: true
# autohashFields:
# _HOSTNAME: true
debug: false
# removeFields:
# - stacktrace
# - msg
# - level
# - time
# mapFields:
# msg: message
# level: severity
# time: '@timestamp'
# transform: !!js/function >
# function (sourceName, parsedObject, config) {
# // map fields
# Object.keys(config.mapFields).forEach(function (f) {
# if (parsedObject[f] !== undefined) {
# parsedObject[config.mapFields[f]] = parsedObject[f]
# if (config.debug) {
# console.log('map ' + f + ' to ' + config.mapFields[f] + ': ' + parsedObject[config.mapFields[f]])
# }
# }
# })
# // remove fields
# for (var i=0; i<config.removeFields.length; i++) {
# if (config.debug) {
# console.log('delete ' + config.removeFields[i])
# }
# delete parsedObject[config.removeFields[i]]
# }
# }
# The global transform function is called for each parsed line.
# A good place to do add global fields, custom date processing, or special parsers.
#globalTransform: !!js/function >
# function (source, parsedObject) {
# // this function is called after parsing
# // regardless of the logging source
# // for pattern specific functions use transform in pattern definitions
# }
# IMPORTANT:
# PATTERNS ARE EVALUATED SEQUENTIALLY FOR EACH LOG EVENT. PUT MORE COMPLEX AND MORE SPECIFIC PATTERNS FIRST.
# As soon as a pattern matches a log event the rest of the patterns are skipped.
#
# To test your pattern: cat myTest.log | logagent -n <pattern name here> -yml -f mypatterns.yml
# A pattern name are things like 'kubernetes hyperkube' or 'Elasticsearch' or 'Apache Solr' below.
patterns:
- # sematext/agent logs
sourceName: !!js/regexp /sematext\/agent|containerd|dockerd/
blockStart: !!js/regexp /^panic\:|^unexpected fault address|^fatal error\:|(^INFO|^ERRO|^WARN|^FAT|^TRAC|^DEB)|^time=|^S{2,}/
match:
- type: sematext_agent_golang
regex: !!js/regexp /time=(\S+)\slevel=(\S+?)\smsg="(.+?)"\ssource="(.+?)"/i
fields: [ts, severity, message, source]
dateFormat: iso
- type: sematext_agent_golang
regex: !!js/regexp /([A-Z]+)\[(.+?)\]\s(.*)/i
fields: [severity, ts, message]
dateFormat: iso
- # Yandex Clickhouse
sourceName: !!js/regexp /clickhouse/
blockStart: !!js/regexp /(\d{4}.\d{2}.\d{2}[\s|T][\d+|\:]+.\d+)\s\[\s(\d+)\s]\s\{(\S*)\}/
match:
- type: clickhouse
regex: !!js/regexp /(\d{4}.\d{2}.\d{2}[\s|T][\d+|\:]+.\d+)\s\[\s(\d+)\s]\s\{(\S*)\}\s<(\S+)>\s((.+?)\:[\s|\S]+)/i
fields: [ts, threadNumber, queryId, severity, message, module]
dateFormat: yyyy.MM.dd HH:mm:ss.SSS
- # kubernetes hyperkube
sourceName: !!js/regexp /hyperkube/
match:
- type: hyperkube
regex: !!js/regexp /^\S+\s(\S+)\s+\S+\s+\S+\s([GET|POST|PUT|DELETE|HEAD|OPTIONS]+)\s+(\/.+)\:\s\(([\d|\.]+)(\S+)\)\s(\d+\s)(.*hyperkube.+)\s(.+)\:(\d+)\]/i
fields: [ts,method,url,duration,duration_unit,status_code,info,ip,port]
dateFormat: HH:mm:ss:S
- # Elasticsearch
blockStart: !!js/regexp /^[\d{4}-\d{2}-\d{2}[\s|T][\d+|\:]+.\d+|log4j\:\S+\s/
sourceName: !!js/regexp /elasticsearch/
match:
- type: elasticsearch_slow_log
regex: !!js/regexp /^\[(\d{4}-\d{2}-\d{2}[\s|T][\d+|\:]+.\d+)\]\[(.+?)\s*\]\[(\S{0,512})\s*\]\s*\[(.+?)\]\s\[(\S+?)\]\[(\d+)\]\s.+took_millis\[(\d+)\].+types\[(.*?)\].+stats\[(.*?)\].*search_type\[(.*?)\].+total_shards\[(.*?)\].+source\[(.*?)\],/i
fields:
- ts
- severity:string
- class_name:string
- node_name:string
- index_name:string
- shard_number:number
- took_millis:number
- types:string
- stats:string
- search_type:string
- total_shards:number
- source:string
- type: elasticsearch
regex: !!js/regexp /^\[(\d{4}-\d{2}-\d{2}[\s|T][\d+|\:]+.\d+)\]\[(.+?)\s*\]\[(\S{0,512})\s*\]\s*\[(.+?)\]\s([\s|\S]+)/
fields: [ts,severity,class_name,node_name,message]
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- type: elasticsearch
regex: !!js/regexp ^\[(\d{4}-\d{2}-\d{2}\s[\d+|\:]+.\d+)\]\[(.+?)\]\[(\S{0,512})\s*\]\s*\s([\s|\S]+)
fields: [ts,severity,class_name,message]
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- # Apache Solr
blockStart: !!js/regexp ^\S*\s*\d{4}-\d{2}-\d{2}\s[\d|\:+,\d]+\.\d{0,3}|^\d+\s+\S{3,5}\s+
sourceName: !!js/regexp /solr/i
match:
- type: apache_solr_7_8_hits
regex: !!js/regexp ^\S*\s*(\d{4}-\d{2}-\d{2}\s[\d|\:+,\d]+\.\d{0,3})\s(.+?)\s+\((.+?)\)\s\[(.+?)]\s(.+?)\s\[(.+?)\]\s+webapp=(.+?)\spath=(.+?)\sparams={(.*)}\shits=(\d+)\sstatus=(\d+)\sQTime=(\d+)
fields:
- ts
- severity:string
- thread:string
- core:string
- class:string
- shard:string
- webapp:string
- path:string
- params:string
- hits:number
- status:number
- qtime:number
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
transform: !!js/function >
function (p) {
if (process.env.PARSE_SOLR_QUERY_PARAMS === '1')
{
var params = p.params.split('&')
p.parsedParams={}
for(var i=0;i<params.length;i++)
{
var key_value = params[i].split('=')
if (key_value.length>1) {
key = key_value[0]
if (!/[a-zA-Z]/.test(key)) {
key = "field_" + key
}
if (key in p.parsedParams) {
// convert from single to multivalued
if (typeof p.parsedParams[key] == 'string') {
p.parsedParams[key] = [p.parsedParams[key]]
}
p.parsedParams[key].push(key_value[1])
} else {
p.parsedParams[key] = key_value[1]
}
}
}
if (p.parsedParams['NOW']) {
p.parsedParams['NOW'] = new Date(p.parsedParams['NOW']*1)
// if (!p['@timestamp'])
// p['@timestamp'] = p.paramsParsed['NOW']
}
}
var core = p.core.split(' ')
//sometimes core=0, sometimes core="c:test s:shard2...."
if (core.length>1){
p.parsedCore={}
for(var i=0;i<core.length;i++)
{
var key_value = core[i].split(':')
if (key_value.length>1) {
p.parsedCore[key_value[0]] = key_value[1]
}
}
}
}
- type: apache_solr_7_8
regex: !!js/regexp ^\S*\s*(\d{4}-\d{2}-\d{2}\s[\d|\:+,\d]+\.\d{0,3})\s(.+?)\s+\((.+?)\)\s\[(.+?)]\s(.+?)\s\[(.+?)\]\s+webapp=(.+?)\spath=(.+?)\sparams={(.*)}\sstatus=(\d+)\sQTime=(\d+)
fields:
- ts
- severity:string
- thread:string
- core:string
- class:string
- shard:string
- webapp:string
- path:string
- params:string
- status:number
- qtime:number
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
transform: !!js/function >
function (p) {
if (process.env.PARSE_SOLR_QUERY_PARAMS === '1')
{
var params = p.params.split('&')
p.parsedParams={}
for(var i=0;i<params.length;i++)
{
var key_value = params[i].split('=')
if (key_value.length>1) {
key = key_value[0]
if (!/[a-zA-Z]/.test(key)) {
key = "field_" + key
}
if (key in p.parsedParams) {
// convert from single to multivalued
if (typeof p.parsedParams[key] == 'string') {
p.parsedParams[key] = [p.parsedParams[key]]
}
p.parsedParams[key].push(key_value[1])
} else {
p.parsedParams[key] = key_value[1]
}
}
}
if (p.parsedParams['NOW']) {
p.parsedParams['NOW'] = new Date(p.parsedParams['NOW']*1)
// if (!p['@timestamp'])
// p['@timestamp'] = p.paramsParsed['NOW']
}
}
var core = p.core.split(' ')
//sometimes core=0, sometimes core="c:test s:shard2...."
if (core.length>1){
p.parsedCore={}
for(var i=0;i<core.length;i++)
{
var key_value = core[i].split(':')
if (key_value.length>1) {
p.parsedCore[key_value[0]] = key_value[1]
}
}
}
}
- type: apache_solr_audit_log
regex: !!js/regexp ^\S*\s*(\d{4}-\d{2}-\d{2}\s[\d|\:+,\d]+\.\d{0,3})\s(.+?)\s*\((.+?)\)\s\[(.+?)]\s(.+?)\stype="(.*?)"\smessage="(.*?)"\smethod="(.*?)"\sstatus="(.*?)"\srequestType="(.*?)"\susername="(.*?)"\sresource="(.*?)"\squeryString="(.*?)"\scollections=(.*)
fields:
- ts
- severity:string
- thread:string
- core:string
- class:string
- type:string
- message:string
- method:string
- status:number
- requestType:string
- username:string
- resource:string
- querystring:string
- collections:string
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- type: apache_solr_7_8_generic
regex: !!js/regexp ^\S*\s*(\d{4}-\d{2}-\d{2}\s[\d|\:+,\d]+\.\d{0,3})\s(.+?)\s+\((.+?)\)\s\[(.+?)]\s(.+?)\s(.*)
fields:
- ts
- severity:string
- thread:string,
- core:string
- class:string
- message:string
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
transform: !!js/function >
function (p) {
var core = p.core.split(' ')
//sometimes core=0, sometimes core="c:test s:shard2...."
if (core.length>1){
p.parsedCore={}
for(var i=0;i<core.length;i++)
{
var key_value = core[i].split(':')
if (key_value.length>1) {
p.parsedCore[key_value[0]] = key_value[1]
}
}
}
}
- type: apache_solr_v4.6
regex: !!js/regexp ^(\S+)\s+-\s(\d{4}-\d{2}-\d{2}\s[\d|\:+,\d]+\.\d{0,3});\s(.+?);\s\[(.+?)]\swebapp=(\S+)\spath=(.+?)\sparams={(.*)}.*hits=(\d+)\sstatus=(\d+)\sQTime=(\d+)
fields: [severity,ts,class,application,webapp,path,params,hits,status,qtime]
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
transform: !!js/function >
function (p) {
if (process.env.PARSE_SOLR_QUERY_PARAMS === '1')
{
var params = p.params.split('&')
p.parsedParams={}
for(var i=0;i<params.length;i++)
{
var key_value = params[i].split('=')
if (key_value.length>1) {
p.parsedParams[key_value[0]] = key_value[1]
}
}
if (p.parsedParams['NOW']) {
p.parsedParams['NOW'] = new Date(p.parsedParams['NOW']*1)
// if (!p['@timestamp'])
// p['@timestamp'] = p.paramsParsed['NOW']
}
}
}
- type: apache_solr
regex: !!js/regexp ^(\S+)\s+-\s(\d{4}-\d{2}-\d{2}\s[\d|\:+,\d]+\.\d{0,3});\s\[\s*(.+?)]\s(\S+);\s.*.*webapp=(\S+)\spath=(.+?)\sparams={(.*)}.*hits=(\d+)\sstatus=(\d+)\sQTime=(\d+)
fields: [severity,ts,application,class,webapp,path,params,hits,status,qtime]
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- type: apache_solr_v5_1
regex: !!js/regexp ^(\d+)\s\[(\S+)]\s(\S+)\s(\S+)\s\[(\S+)\s(\S+)\s(\S+)\s(\S+)\].+?\[(.+?)\]\swebapp=(.+?)\spath=(.+?)\sparams={(.+?)}\sstatus=(\d+)\sQTime=(\d+)
fields: [relative_ts,thread_id,severity,class,collection,shard,core,replica,core_name,webapp,path,params,status,qtime]
transform: !!js/function >
function (p) {
if (process.env.PARSE_SOLR_QUERY_PARAMS === '1')
{
var params = p.params.split('&')
p.parsedParams={}
for(var i=0;i<params.length;i++)
{
var key_value = params[i].split('=')
if (key_value.length>1)
p.parsedParams[key_value[0]] = key_value[1]
}
if (p.parsedParams['NOW']) {
p.parsedParams['NOW'] = new Date(p.parsedParams['NOW']*1)
// if (!p['@timestamp'])
// p['@timestamp'] = p.paramsParsed['NOW']
}
}
}
- type: apache_solr
regex: !!js/regexp ^(\S+)\s+-\s+(\d{4}-\d{2}-\d{2}\s[\d|\:+,\d]+\.\d{0,3});\s+(\S+);\s+(.+Exception:\s[\s|\S]+)
fields: [severity,ts,class,message]
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- type: apache_solr
regex: !!js/regexp ^(\S+)\s+-\s+(\d{4}-\d{2}-\d{2}\s[\d|\:+,\d]+\.\d{0,3});\s+(\S+);\s([\s|\S]+)
fields: [severity,ts,class,message]
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- type: apache_solr_5_generic
regex: !!js/regexp ^(\S+)\s+-\s+(\d{4}-\d{2}-\d{2}\s[\d|\:+,\d]+\.\d{0,3});\s(.*)
fields: [severity,ts,message]
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- type: apache_solr4
regex: !!js/regexp ^(\d+)\s+(\S+)\s+\((\S+)\)\s+\[(.+?)\]\s(\S+)\s(.+)
fields: [relative_ts,severity,thread,thread_id,class,message]
- # Apache Kafka
sourceName: !!js/regexp /kafka/
match:
- type: apache_kafka
regex: !!js/regexp ^\[(\d{4}-\d{2}-\d{2}\s[\d|\:]+,\d+)\]\s(\S+)\s(.+)
fields: [ts,severity,message]
dateFormat: yyyy-MM-dd HH:mm:ss
- # Apache HDFS Data Node
blockStart: !!js/regexp ^\d{4}-\d{2}-\d{2}\s[\d|\:]+,\d+\s(\S+)\s/
sourceName: !!js/regexp /hdfs/
match:
- type: apache_hdfs_data_node
regex: !!js/regexp ^(\d{4}-\d{2}-\d{2}\s+[\d|\:]+,\d+)\s+(\S+)\s(\S+):\s([\s|\S]+)
fields: [ts,severity,class,message]
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- # Apache HBase Region Server
blockStart: !!js/regexp ^\d{4}-\d{2}-\d{2}\s[\d|\:]+,\d+\s(\S+)\s/
sourceName: !!js/regexp /hbase/
match:
- type: apache_hbase_region_server
regex: !!js/regexp ^(\d{4}-\d{2}-\d{2}\s+[\d|\:]+,\d+)\s+(\S+)\s+\[(.+)\]\s(\S+):\s([\s|\S]+)
fields: [ts,severity,thread,class,message]
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- # Apache YARN
sourceName: !!js/regexp /yarn/
match:
- type: apache_hadoop_yarn_node_manager
regex: !!js/regexp ^(\d{4}-\d{2}-\d{2}\s[\d|\:]+,\d+)\s(\S+)\s(\S+):\s([\S|\s]+)
fields: [ts,severity,class_name,message]
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- # Apache Zookeeper
sourceName: !!js/regexp /zookeeper|zk/
blockStart: !!js/regexp /^\d{4}-\d{2}-\d{2}\s[\d|\:]+,\d+\s+/
match:
- type: apache_zookeeper
regex: !!js/regexp /^(\d{4}-\d{2}-\d{2}\s[\d|\:]+,\d+)\s+\[(\S+?):{0,1}\]\s+-\s+(\S+)\s+\[(.+)\]\s-\s+([\S|\s]+[client|from]\s\/(.+?)\:(\d+).*sessionid.+(0x.+).*)/
fields:
- ts
- machineId:string
- severity:string,
- thread_info:string
- message:string
- client_ip:string
- client_port:number
- session_id:string
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- type: apache_zookeeper
regex: !!js/regexp /^(\d{4}-\d{2}-\d{2}\s[\d|\:]+,\d+)\s+\[(\S+?):{0,1}\]\s+-\s+(\S+)\s+\[(.+)\]\s-\s+([\S|\s]+[client|from]\s\/(.+?)\:(\d+).*)/
fields:
- ts
- machineId:string
- severity:string,
- thread_info:string
- message:string
- client_ip:string
- client_port:number
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- type: apache_zookeeper
regex: !!js/regexp /^(\d{4}-\d{2}-\d{2}\s[\d|\:]+,\d+)\s+\[(\S+?):{0,1}\]\s+-\s+(\S+)\s+\[(.+)\]\s-\s+([\S|\s]+)/
fields:
- ts
- machineId:string
- severity:string,
- thread_info:string
- message:string
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- # Apache Cassandra
sourceName: !!js/regexp cassandra
# multi-line, start sequence
blockStart: !!js/regexp ^\S{3,5}\s+\[.+\]\s+\d{4}
match:
- type: apache_cassandra
regex: !!js/regexp ^\S{0,5}(\S*)\s+\[(.+)\]\s(\d{4}-\d{2}-\d{2}\s[\d|\:]+,\d+)\s+(.+\.java)\:(\d+)\s+-\s+([\S|\s]+)
fields: [severity,module,ts,java_file,code_line,message]
dateFormat: yyyy-MM-dd HH:mm:ss,SS
- # MongoDB
# name of the docker image
sourceName: !!js/regexp /mongo/
# 2015-07-28T00:35:46.329+0000 I JOURNAL [initandlisten] journal dir=/data/db/journal
match:
- type: mongodb
regex: !!js/regexp /^(\d{4}-\d{2}-\d{2}T[\d|\.|\:]+\+\d{4})\s(\w+)\s(\S+)\s+\[(\S+)\]\s(.+)/i
fields: [ts,severity, component, context, message]
dateFormat: iso
- # REDIS
# name of the docker image
# example: "1:M 22 Jul 21:58:28.146 # Server started, Redis version 3.0.2"
sourceName: !!js/regexp /redis/i
blockStart: !!js/regexp /^\d+:.\s\d+/
match:
- type: redis
blockStart: !!js/regexp /^\d+:.\s\d+/
fields: [pid,role,ts,level,message]
regex: !!js/regexp /^(\d+):(\w+)\s+(\d\d\s\w+.+)\s+(\S)\s+([\S|\s]+)/
dateFormat: dd MMM HH:mm:ss.SSS
transform: !!js/function >
function transformMessage (p) {
levels = {
'.': 'debug',
'-': 'verbose',
'*': 'notice',
'#': 'warning'
}
roles = {
'X': 'sentinel',
'C': 'RDB/AOF writing child',
'S': 'slave',
'M': 'master'
}
p.role = roles[p.role]
p.severity = levels[p.level] || p.level
// p.message = p.message.replace(/\r/g,'')
delete p.level
}
- # Sonatype Nexus
sourceName: !!js/regexp /nexus/
# yyyy-MM-dd starts a new log entry
blockStart: !!js/regexp ^\d{4}-\d{2}-\d{2}
match:
- type: nexus
regex: !!js/regexp /^([\d|\-|\s|\:|\.|\,|\+]+)\s+([A-Z]+)\s+[^\[]*\[\s*([^\]]+)\]\s(\*?\w+)\s+([\w|\.]+)\W+(.+)/
fields: [ts,severity,thread,user,class,message]
dateFormat: yyyy-MM-dd HH:mm:ss,SSSX
- # NodeBB Forum
sourceName: !!js/regexp /nodebb/i
match:
- type: nodebb_forum
fields: [ts,severity,module,message]
regex: !!js/regexp /^(\d{4}\-\d{2}\-\d{1,2}T\d\d:\d\d:\d\d\.\d+Z)\s-\s(\w+):\s\[(\S+)]\s(.*)/
dateFormat: iso
- type: nodebb_forum
fields: [ts,severity,message]
regex: !!js/regexp /^(\d{4}\-\d{2}\-\d{1,2}T\d\d:\d\d:\d\d\.\d+Z)\s-\s(\w+):\s(.*)/
- # mysql
# 2015-07-25 14:11:35 0 [Note] mysqld (mysqld 5.6.26) starting as process 1 ...
sourceName: !!js/regexp /mysql/
match:
- regex: !!js/regexp /^(\d{4}-\d{2}-\d{2}\s[\d|\:]+)\s(\d+)\s\[(.+?)\]\s+(.*)/
fields: [ts,pid,level,message]
dateFormat: yyyy-MM-dd HH:mm:ss
type: mysql
- # nsq.io
sourceName: !!js/regexp nsqio\/nsq
match:
- type: nsq
regex: !!js/regexp (^\d{4}\/\d{2}\/\d{2}\s[\d|\:]+)\s(\S+)\s+(\d+)\s+\[(\S+)\]\s+(.+)
fields: [ts, level, pid, module, message]
dateFormat: yyyy/MM/dd HH:mm:ss
- # Web Logs
sourceName: !!js/regexp /httpd|access_log|apache2|nginx|sematext\/frontend-app/
match:
- type: access_log_combined
regex: !!js/regexp ^([0-9a-f.:]+)\s(-|\S+)\s(-|\S+)\s\[(.*)\]\s\"(\w+)\s(\S+)\s{0,1}(.*)\" ([0-9|\-]+) ([0-9|\-]+) \"([^\"]+)\" \"([^\"]+)\"
fields:
- client_ip:string
- remote_id:string
- user:string
- ts
- method:string
- path:string
- protocol:string
- status_code:number
- size:number
- referer:string
- user_agent:string
dateFormat: dd/MMM/yyyy:HH:mm:ss X
transform: !!js/function >
function transformMessage (p) {
p.message = p.method + ' ' + p.path
if(p.status_code === '-') {
p.status_code = 0
}
if(p.size === '-') {
p.size = 0
}
}
# nginx proxy jwilder/nginx-proxy
- regex: !!js/regexp /^(\S+)\s+(-|.+?)\s+(-|.+?)\s+\[(.*)\]\s\"(\S+)\s(\S+)\s(\S+)\"\s(\d+)\s(\d+|\"-\"|-)\s+"{0,1}(.+?)"{0,1}\s+"{0,1}([\S|\s]+)"{0,1}/i
type: access_common
fields:
- proxy_service:string
- virtual_host:string
- client_ip:string
- remote_id:string
- user:String
- ts
- method:string
- path:string
- http_version:string
- status_code:number
- size:number
- url:string
- user_agent:string
dateFormat: dd/MMM/yyyy:HH:mm:ss X
#transform: !!js/function >
# function transformMessage (p) {
# p.message = p.method + ' ' + p.path
# if(p.status_code === '-') {
# p.status_code = 0
# }
# if(p.size === '-') {
# p.size = 0
# }
# }
- regex: !!js/regexp ^(\S+)\s+(-|.+?)\s+(-|.+?)\s+\[(.*)\]\s\"(\S+)\s(\S+)\s(\S+)\"\s(\d+)\s(\d+|\"-\"|-)
type: access_common
fields:
- client_ip:string
- remote_id:string
- user:string
- ts
- method:string
- path:string
- http_version:string
- status_code:number
- size:number
dateFormat: dd/MMM/yyyy:HH:mm:ss X
#transform: !!js/function >
# function transformMessage (p) {
# p.message = p.method + ' ' + p.path
# if(p.status_code === '-') {
# p.status_code = 0
# }
# if(p.size === '-') {
# p.size = 0
# }
# }
- type: nginx_error_log
regex: !!js/regexp /^(\d{4}\/\d{2}\/\d{2}\s[\d|\:]+)\s\[(.+?)]\s(\d+)#(\d+)\:\s(.*)/
fields: [ts,level,pid,tid,message]
dateformat: yyyy/MM/dd HH:mm:ss
- type: apache_error_log
regex: !!js/regexp /^\[(\w{3} \w{3} \d{2} [\d|\:]+\s\d+)\] \[(.+?)\] \[client ([\d|\.]+)\] (.+)/
fields: [ts,level,client_ip,message]
dateformat: ddd MMM dd hh:mm:ss.SSS yyyy
# Apache MPM events
- regex: !!js/regexp /^\[(.+?)\]\s+\[(.+?)\]\s+\[(.+?)\]\s+(.+)/
fields: [ts,event_type,processInfo,message]
type: apache_mpm
dateformat: ddd MMM dd hh:mm:ss.SSS yyyy
- # Apache Flink jobmanager and taskmanager
sourceName: !!js/regexp /flink/
blockStart: !!js/regexp /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2},\d{3}\s/
match:
- type: flink[job|task]manager
regex: !!js/regexp /^(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2},\d{3})\s(INFO|info|WARN|ERROR|FATAL)\s+([\S]+)\s+-\s([\S|\s|\n]+)/
fields: [ts, severity, processid, message]
dateFormat: yyyy-MM-dd HH:mm:ss:l
- # Apache Flink jobmanager and taskmanager
sourceName: !!js/regexp /flink/
blockStart: !!js/regexp /^\w{3}\s[\d|,|\s|\:]+/
match:
- type: flink[job|task]manager
regex: !!js/regexp /^(\w{3}\s[\d|,|\s|\:]+\w{3}\s[\d|,|\s|\:]+[AP]M)\s([\S|\s]+)\s(INFO|WARN|ERROR|SEVERE|FATAL):\s([\S|\s|\n]+)/
fields: [ts, processid, severity, message]
dateFormat: MMM dd, yyyy H:mm:ss
- # Traefik access_log
sourceName: !!js/regexp /traefik/
match:
- type: traefik_access_log
regex: !!js/regexp ^([0-9a-f.:]+)\s(-|\S+)\s(-|\S+)\s\[(.*)\]\s\"(\w+)\s(\S+)\s{0,1}(.*)\"\s([0-9|\-]+)\s([0-9|\-]+)\s\"([^\"]+)\"\s\"([^\"]+)\"\s([0-9|\-]+)\s\"(.+)\"\s\"(.+)\"\s([0-9]+)ms
fields:
- client_ip:string
- remote_id:string
- user:string
- ts
- method:string
- path:string
- protocol:string
- status_code:number
- size:number
- referer:string
- user_agent:string
- req_count:string # https://github.com/containous/traefik/blob/master/middlewares/accesslog/logger_formatters.go#L45
- frontend_name:string
- backend_url:string
- response_time:number
dateFormat: dd/MMM/yyyy:HH:mm:ss X
transform: !!js/function >
function transformMessage (p) {
p.message = p.method + ' ' + p.path
if(p.status_code === '-') {
p.status_code = 0
}
if(p.size === '-') {
p.size = 0
}
}
- # Tutum Logs
sourceName: !!js/regexp /tutum\/cleanup/
match:
- type: tutum_cleanup
regex: !!js/regexp /^(\d+\/\d+\/\d+\s\d+:\d+:\d+)\s(.*)/
fields: [ts,message]
dateFormat: yyyy/MM/dd hh:mm:ss
- # RabbitMQ
sourceName: !!js/regexp /rabbitmq/
blockStart: !!js/regexp /^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d/
match:
- type: rabbitmq_startup
# regex: !!js/regexp /^(\S+\s\S+)\s\[(\S+)\]\s<(\S+)>\s*\n\s*(Starting\sRabbitMQ\s(\S+)\son\sErlang\s(.+)\n[\s\S]*)/
regex: !!js/regexp /^(\S+\s\S+)\s\[(\S+)\]\s<(\S+)>\s*\n\s*(Starting\sRabbitMQ\s(\S+)\son\sErlang\s(.+)\s*\n\s*(Copyright\s\(c\)\s\d{4}-\d{4}\s[^\n]*)\s*\n\s*Licensed\sunder\sthe\s(\S*\s?\d*\.?\d?)[\s\S]*)/
fields:
- ts
- severity
- connection:string
- message
- rabbitmq_version
- erlang_version
- copyright
- license
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- type: rabbitmq_wal_recovery
regex: !!js/regexp /^(\S+\s\S+)\s\[(\S+)\]\s<(\S+)>\s(WAL:\srecovering\s\[(.*)\])/
fields:
- ts
- severity
- connection:string
- message
- wal_path:string
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- type: rabbitmq_access_denied
regex: !!js/regexp /^(\S+\s\S+)\s\[(\S+)\]\s<(\S+)>\s(.+access\sdenied:\suser\s'(\S+)'\s-\s(.+))/
fields:
- ts
- severity
- connection:string
- message
- user:string
- reason:string
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- type: rabbitmq_login_refused
regex: !!js/regexp /^(\S+\s\S+)\s\[(\S+)\]\s<(\S+)>\sError\son\sAMQP\sconnection\s<(\S+)>\s\((\S+):(\d+)\s->\s(\S+):(\d+),\sstate:\s(\S+)\):\n((\S+)\slogin\srefused:\suser\s'(\S+)'\s-\s(.+))/
fields:
- ts
- severity
- connection:string
- refused_connection:string
- source_address:string
- source_port:number
- destination_address:string
- destination_port:number
- state:string
- message
- auth_method:string
- user:string
- reason:string
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- type: rabbitmq_connections_authenticated
regex: !!js/regexp /^(\S+\s\S+)\s\[(\S+)\]\s<(\S+)>\sconnection\s<\S+>\s\((\S+):(\d+)\s->\s(\S+):(\d+)\):\s(user\s'(\S+)'\sauthenticated\sand\sgranted\saccess\sto\svhost\s'(\S+)\')/
fields:
- ts
- severity
- connection:string
- source_address:string
- source_port:number
- destination_address:string
- destination_port:number
- message
- user:string
- vhost:string
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- type: rabbitmq_connections_vhost_user
regex: !!js/regexp /^(\S+\s\S+)\s\[(\S+)\]\s<(\S+)>\s(accepting|closing)\sAMQP\sconnection\s<\S+>\s\((\S+):(\d+)\s->\s(\S+):(\d+),\svhost:\s'(.+)',\suser:\s'(.+)'\):?([\s\S]*)/
fields:
- ts
- severity
- connection:string
- connection_event
- source_address:string
- source_port:number
- destination_address:string
- destination_port:number
- vhost:string
- user:string
- message
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- type: rabbitmq_connections
regex: !!js/regexp /^(\S+\s\S+)\s\[(\S+)\]\s<(\S+)>\s(accepting|closing)\sAMQP\sconnection\s<\S+>\s\((\S+):(\d+)\s->\s(\S+):(\d+)\)([\s\S]*)/
fields:
- ts
- severity
- connection:string
- connection_event
- source_address:string
- source_port:number
- destination_address:string
- destination_port:number
- message
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- type: rabbitmq
regex: !!js/regexp /^(\S+\s\S+)\s\[(\S+)\]\s\<(\S+)\>\s([\s\S]+)/
fields:
- ts
- severity
- connection:string
- message
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- # Postgres
sourceName: !!js/regexp /postgres/
blockStart: !!js/regexp /^(\S+\s\S+)\s(\S+)\s\[(\d+)\]/
match:
- type: postgres_slowlog
regex: !!js/regexp /^(\S+\s\S+)\s(\S+)\s\[(\d+)\]\s(\S+)@(\S+)\s(\S+):\s+duration:\s(\S+)\sms\s+(\S+).*:\s+([\S|\s]+)/
fields:
- ts
- timezone:string
- pid:number
- user:string
- database:string
- severity:string
- duration_ms:number
- operation:string
- statement:string
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- type: postgres_with_user
regex: !!js/regexp /^(\S+\s\S+)\s(\S+)\s\[(\d+)\]\s(\S+)@(\S+)\s(\S+):\s+([\S|\s]+)/
fields:
- ts
- timezone:string # assuming timezone is always "UTC", but parsing it just in case
- pid:number
- user:string
- database:string
- severity:string
- message
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- type: postgres
regex: !!js/regexp /^(\S+\s\S+)\s(\S+)\s\[(\d+)\]\s(\S+):\s+([\S|\s]+)/
fields:
- ts
- timezone:string # assuming timezone is always "UTC", but parsing it just in case
- pid:number
- severity:string
- message
dateFormat: yyyy-MM-dd HH:mm:ss.SSS
- # CouchDB
sourceName: !!js/regexp /couchdb/
match:
- type: couchdb
regex: !!js/regexp /^\[(\S+)\]\s(\S+)\s(\S+)\s(\S+)\s(\S{8})\s([\s|\S]+)/
fields:
- severity:string
- ts
- node:string
- module:string
- code:string
- message:string
dateFormat: iso
transform: !!js/function >
function (p) {
p.os = {host: p.node}
}
- type: couchdb_http
regex: !!js/regexp /^\[(\S+)\]\s(\S+)\s(\S+)\s(\S+)\s(\S{10})\s(\S+):(\d+)\s(\S+)\s(\S+)\s(GET|PUT|POST|DELETE|HEAD)\s(\S+)\s(\d+)\s(\S|\s+)/
fields:
- severity:string
- ts
- node:string
- module:string
- code:string
- server_ip:string
- server_port:number
- client_ip:string
- user:string
- method:string
- url:string
- status_code:number
- response:string
transform: !!js/function >
function (p) {
p.os = {host: p.node}
}
dateFormat: iso
- # Heroku Syslog Messages
sourceName: !!js/regexp /syslog_framed|heroku/
match:
-
type: heroku
# blockStart: !!js/regexp \^+\s<(\d+)>(\d+)\s/
regex: !!js/regexp ^\d*\s{0,1}<(\d+)>(\d+)\s(\S+)\s(\S+)\s(\S+)\s(\S+)\.{0,1}(\d*)\s+-\s(.*)
fields: [prio,version,ts,host,app,process_type,dyno,message]
dateFormat: iso
transform: !!js/function >
function (p) {
p.os = {host: p.host}
const SEVERITY = [
'emerg',
'alert',
'crit',
'err',
'warning',
'notice',
'info',
'debug'
]
const FACILITY = [
'kern',
'user',
'mail',
'daemon',
'auth',
'syslog',
'lpr',
'news',
'uucp',
'cron',
'authpriv',
'ftp',
'ntp',
'logaudit',
'logalert',
'clock',
'local0',
'local1',
'local2',
'local3',
'local4',
'local5',
'local6',
'local7'
]
p.facility = FACILITY[p.prio>>3] || String(p.prio>>3)
p.severity = SEVERITY[p.prio&7] || String(p.prio&7)
if (p.process_type === 'router')
{
try {
var keyValue = p.message.trim().split(' ')
keyValue.forEach (function (kv) {
var kvs = kv.split ('=')
p[kvs[0].trim()] = kvs[1].trim()
})
} catch (err) {
// ignore
}
}
}
- # CloudFoundry Syslog Messages
sourceName: !!js/regexp /cloudfoundry.*|syslog_raw/
match:
-
type: cloudfoundry
regex: !!js/regexp ^\d*\s{0,1}<(\d+)>(\d+)\s([\d|-]+T[\d|\:|.|\+]+)\s([a-zA-Z0-9\-\.\_\s]+)\s(.+?)\s\[(.+)\]\s-\s\[(.*)\]\s([a-zA-Z0-9\.\_]+)\s-\s\[[\d|-]+T[\d|\:|.]+Z\]\s(.*)
fields: [prio,version,ts,host,processID,applicationID,tags,domain,message]
dateFormat: iso
transform: !!js/function >
function (p) {
const SEVERITY = [
'emerg',
'alert',
'crit',
'err',
'warning',
'notice',
'info',
'debug'
]
const FACILITY = [
'kern',
'user',
'mail',
'daemon',
'auth',
'syslog',
'lpr',
'news',
'uucp',
'cron',
'authpriv',
'ftp',
'ntp',
'logaudit',
'logalert',
'clock',
'local0',
'local1',
'local2',
'local3',
'local4',
'local5',
'local6',
'local7'
]
p.facility = FACILITY[p.prio>>3] || String(p.prio>>3)
p.severity = SEVERITY[p.prio&7] || String(p.prio&7)
delete p.prio
p.os = {host: p.host}
}
-
type: cloudfoundry
regex: !!js/regexp ^\d*\s{0,1}<(\d+)>(\d+)\s([\d|-]+T[\d|\:|.|\+]+)\s([a-zA-Z0-9\-\.\_\s]+)\s(.+?)\s\[(.+)\]\s-\s\[(.*)\]\s(.*)
fields: [prio,version,ts,host,processID,applicationID,tags,message]
dateFormat: iso
transform: !!js/function >
function (p) {
const SEVERITY = [
'emerg',
'alert',