Skip to content

Instantly share code, notes, and snippets.

@wcomnisky
Created November 23, 2023 22:09
Show Gist options
  • Save wcomnisky/9350b380934b335c44bf81a4aec7f3df to your computer and use it in GitHub Desktop.
Save wcomnisky/9350b380934b335c44bf81a4aec7f3df to your computer and use it in GitHub Desktop.
New Relic logs parsing

New Relic Logs Parsing

To create a log parsing rule follow the steps below.

  • Access https://one.newrelic.com/logger/log-parsing
  • Hit the "Create parsing rule" button
  • Fill in the fields:
    • Name as you like
    • Field to parse any field available in the logs; usually the message
    • Filter logs based on NRQL examples:
      • message like '%Search result request.%'
      • message like '% GET /%' OR message like '% POST /%' OR message like '% DELETE %'
    • Parsing rule examples below, where the word between <...> becomes the searcheable Attributes:
      • Search result request. Keyword: (?<keywords>(.*)), Latlong: (?<latlong>-?\d+\.\d+,-?\d+\.\d+), Distance: (?<distance>\d+), Limit: (?<limit>\d+), Offset: (?<offset>\d+)
      • ^(?<ip>(.*?)) \| (?<datetimereq>.*?Z) \| (?<req>(GET|POST|DELETE) \/.*?)

Additional information can be found in the official docs: https://docs.newrelic.com/docs/logs/ui-data/parsing/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment