Skip to content

Use Vector Remap Language (VRL) to parse out fields from logs #422

Description

@BryceStevenWilley

We've successfully got logs flowing into our Grafana instance, but there's still some additional parsing of fields that we could add to the logs themselves to make it easier to read through and understand the logs in Grafana.

The Fly log-shipper uses Vector to handle the log events, which uses Vector Remap Language (VRL) to parse out the text from the actual log content into JSON fields in the log event.

Tasks:

  • change the log format in logback. xml (
    <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [server=%X{serverId}] [user=%X{userId}] [session=%X{sessionId}] [corr=%X{correlationId}] [req=%X{requestId}] [op=%X{operation}]%n %-5level %-35logger{35} - %msg %rEx%n</pattern>
    ) to output everything in a JSON format instead of a log line.
    • Slightly worse local development, but worth it IMO.
    • Specifically make sure that exceptions print all to a single line instead of breaking it up into multiple lines
  • write the VRL script to add the fields we care about:
     . = parse_json!(string!(.message))
     del(.userId) # better for privacy, less useful than session ID I think
     # is there a way to make the exceptions show new lines again, so they don't show up all on one (wrapped) line in grafana?
    
  • figure out where to put that VRL script in the log shipper

Metadata

Metadata

Assignees

Labels

opsOperations, i.e. production running

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions