GitXplorerGitXplorer
h

newrelic-grep

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
46e0a364137ac2e07803a3f5ffcba7de5532afe1

verup

hhirachan committed 2 years ago
Unverified
a8deb8a7bd3808575f42bc0e4d607b11b40c47cb

add some test for attribute

hhirachan committed 2 years ago
Unverified
672c256334212133215d86ca983d6cb3ce02b9ef

fix for backslash in pattern

hhirachan committed 2 years ago
Unverified
82b92f9a64ca2abe1486e812567b7ca8d03c4b73

refactoring

hhirachan committed 2 years ago
Unverified
e9ff5438bde8df0c3a06e7a5fcad89e9f77301a5

ver up

hhirachan committed 2 years ago
Unverified
a588f78a5c96d61b90c884103709db5ceccdf5f0

change -v option to -d, -v will be used later

hhirachan committed 2 years ago

README

The README file for this repository.

grep command for New Relic Logs

This package provides a command nrgrep which is grep-like command for New Relic Logs.

New Relic can store plenty of logs and we can query it really fast on the very nice UI on the web site, but some of developers still prefer to use command line interface to query logs than modern UIs. This command helps such kind of people.

Install

pip install newrelic-grep

Prereqiusits

Set environment variables to access New Relic API:

NR_API_KEY USER API key

NR_ACCOUNT_ID Account ID of New Relic User

Usage

# nrgrep [--since DATETIME] [--until DATETIME] <KeyWord to search>

Exapmple

nrgrep --since 20230301140000 --until 20230301150000 'Failed to write'

Options

--since Start time to be queried. Format is YYYYmmddHHMMSS. You can omit right part if you want. 2023030114 will be 20230301140000 Default is 3 days ago.

--until End time to be queried. Format is as same as --since

-a Show attibute before log message. You can use this option multiple times.

Ex.

nrgrep -a hostname -a logtype 'Failed to write'

-q Query to attributes. Format is Attribute Name:Value. You can use this option multiple times.

Ex.

ngrep -q hostname:myhost -q service=api 'Failed to write'

-d Show queries to be sent.