Skip to content

Instantly share code, notes, and snippets.

@starteleport
Created November 15, 2021 14:59
Show Gist options
  • Save starteleport/ed66f30b7161f185658e711a7a95a2a2 to your computer and use it in GitHub Desktop.
Save starteleport/ed66f30b7161f185658e711a7a95a2a2 to your computer and use it in GitHub Desktop.
Introducing rewrite_tag breaks multiline in 1.8.7+ - repro
[MULTILINE_PARSER]
name multiline_dotnet_console
type regex
#
# Regex rules for multiline parsing
# ---------------------------------
#
# configuration hints:
#
# - first state always has the name: start_state
# - every field in the rule must be inside double quotes
#
# rules | state name | regex pattern | next state
# ------|---------------|--------------------------------------------
rule "start_state" "/^info:/" "cont"
rule "cont" "/^\s{4,}/" "cont"
[SERVICE]
Daemon Off
Flush 1
Log_Level debug
Parsers_File custom_parsers-repro.conf
HTTP_Server Off
HTTP_Listen 0.0.0.0
HTTP_Port 2020
Health_Check Off
[INPUT]
Name tail
Path ./repro-external-api-745f757c59-ndgg8_staging_repro-external-api-4303caf1c98782551d123e21f7ea93b56f87b3c59c27e1d325cb126abf6eda6d.log
multiline.parser docker, cri
Tag kube.*
Mem_Buf_Limit 5MB
Skip_Long_Lines On
Refresh_Interval 5
Read_from_Head true
[FILTER]
Name kubernetes
Match kube.*
Merge_Log On
Keep_Log Off
K8S-Logging.Parser On
K8S-Logging.Exclude On
use_tag_for_meta on
[FILTER]
name multiline
match kube.*
multiline.key_content log
multiline.parser multiline_dotnet_console
[OUTPUT]
Name stdout
Match *
[SERVICE]
Daemon Off
Flush 1
Log_Level debug
Parsers_File custom_parsers-repro.conf
HTTP_Server Off
HTTP_Listen 0.0.0.0
HTTP_Port 2020
Health_Check Off
[INPUT]
Name tail
Path ./repro-external-api-745f757c59-ndgg8_staging_repro-external-api-4303caf1c98782551d123e21f7ea93b56f87b3c59c27e1d325cb126abf6eda6d.log
multiline.parser docker, cri
Tag kube.*
Mem_Buf_Limit 5MB
Skip_Long_Lines On
Refresh_Interval 5
Read_from_Head true
[FILTER]
Name kubernetes
Match kube.*
Merge_Log On
Keep_Log Off
K8S-Logging.Parser On
K8S-Logging.Exclude On
use_tag_for_meta on
[FILTER]
Name rewrite_tag
Match kube.*
Rule $kubernetes['namespace_name'] ^(staging|production)$ apps false
Emitter_Name apps_tag_rewriter
[FILTER]
name multiline
match apps
multiline.key_content log
multiline.parser multiline_dotnet_console
[OUTPUT]
Name stdout
Match *
{"log":"info: Microsoft.AspNetCore.Hosting.Diagnostics[2]\n","stream":"stdout","time":"2021-11-10T15:39:34.790353236Z"}
{"log":" =\u003e SpanId:01505dc18911774c, TraceId:b86129629f6999479b90a26bae122e46, ParentId:0000000000000000 =\u003e ConnectionId:0HMD3I6TBKKDA =\u003e RequestPath:/ RequestId:0HMD3I6TBKKDA:00000002\n","stream":"stdout","time":"2021-11-10T15:39:34.79036159Z"}
{"log":" Request finished HTTP/1.1 GET http://10.0.2.125:80/ - - - 200 - text/plain;+charset=utf-8 0.1316ms\n","stream":"stdout","time":"2021-11-10T15:39:34.790376879Z"}
{"log":"info: Microsoft.AspNetCore.Hosting.Diagnostics[1]\n","stream":"stdout","time":"2021-11-10T15:39:44.788911426Z"}
{"log":" =\u003e SpanId:0418144220ef6845, TraceId:cfe54fe94ecaaa44ab09457f7f868752, ParentId:0000000000000000 =\u003e ConnectionId:0HMD3I6TBKKDC =\u003e RequestPath:/ RequestId:0HMD3I6TBKKDC:00000002\n","stream":"stdout","time":"2021-11-10T15:39:44.789284381Z"}
{"log":" Request starting HTTP/1.1 GET http://10.0.2.125:80/ - -\n","stream":"stdout","time":"2021-11-10T15:39:44.789428947Z"}
{"log":"info: Microsoft.AspNetCore.Hosting.Diagnostics[2]\n","stream":"stdout","time":"2021-11-10T15:39:44.789629801Z"}
{"log":" =\u003e SpanId:0418144220ef6845, TraceId:cfe54fe94ecaaa44ab09457f7f868752, ParentId:0000000000000000 =\u003e ConnectionId:0HMD3I6TBKKDC =\u003e RequestPath:/ RequestId:0HMD3I6TBKKDC:00000002\n","stream":"stdout","time":"2021-11-10T15:39:44.789646104Z"}
{"log":" Request finished HTTP/1.1 GET http://10.0.2.125:80/ - - - 200 - text/plain;+charset=utf-8 0.1946ms\n","stream":"stdout","time":"2021-11-10T15:39:44.789651707Z"}
{"log":"info: Microsoft.AspNetCore.Hosting.Diagnostics[1]\n","stream":"stdout","time":"2021-11-10T15:39:44.789656241Z"}
{"log":" =\u003e SpanId:5018968b4ab3f342, TraceId:94b3b5b666fba84ca420f0a336559e7b, ParentId:0000000000000000 =\u003e ConnectionId:0HMD3I6TBKKDD =\u003e RequestPath:/ RequestId:0HMD3I6TBKKDD:00000002\n","stream":"stdout","time":"2021-11-10T15:39:44.789660238Z"}
{"log":" Request starting HTTP/1.1 GET http://10.0.2.125:80/ - -\n","stream":"stdout","time":"2021-11-10T15:39:44.789664262Z"}
{"log":"info: Microsoft.AspNetCore.Hosting.Diagnostics[2]\n","stream":"stdout","time":"2021-11-10T15:39:44.789667968Z"}
{"log":" =\u003e SpanId:5018968b4ab3f342, TraceId:94b3b5b666fba84ca420f0a336559e7b, ParentId:0000000000000000 =\u003e ConnectionId:0HMD3I6TBKKDD =\u003e RequestPath:/ RequestId:0HMD3I6TBKKDD:00000002\n","stream":"stdout","time":"2021-11-10T15:39:44.789671454Z"}
{"log":" Request finished HTTP/1.1 GET http://10.0.2.125:80/ - - - 200 - text/plain;+charset=utf-8 0.1048ms\n","stream":"stdout","time":"2021-11-10T15:39:44.789675595Z"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment