INFO
Setup wizard → the Log source step (the last one). An install reads application logs from exactly one source — AWS CloudWatch Logs, New Relic, or none — chosen in the wizard. This page is the New Relic side. Whatever the source, Sariva reads no app’s logs until a platform SRE approves it per app — on-demand chat scans and scheduled monitoring separately, each with caps the SRE sets — and the install may carry an optional budget — see App logs & pod health.
SELECT … FROM Log WHERE <the app's locator> SINCE <window> per scan, counting every one of the app’s patterns across the app’s log fields in that single query, plus one sample query for the evidence lines an alert or a chat answer shows. It authenticates with a User API key (NRAK-…) sent as the API-Key header. Nothing is written to New Relic, and no agent is installed.
What you need first
- The account ID of the New Relic account your apps’ logs land in (shown in the account picker and in the URL of the New Relic UI).
- Whether that account is in New Relic’s US or EU region — EU accounts are served from
api.eu.newrelic.com; everything else fromapi.newrelic.com. Pick the wrong one and every read is rejected. - A User API key of a user who can run NRQL against that account. Create a dedicated user for Sariva with read-only access (a Read only role in a group that has access to the account — check New Relic’s docs for the current UI path under API keys; the key type must be User, not Ingest). The key is shown once; copy it then.
- Outbound HTTPS from the Sariva platform to
api.newrelic.com(orapi.eu.newrelic.com) on 443.HTTPS_PROXY/NO_PROXYare honoured like every other Sariva client. - Your apps’ logs already in New Relic — shipped by whatever you run today (the infrastructure agent, the Kubernetes integration, Fluent Bit’s New Relic output, APM logs-in-context). Sariva only reads.
Step 1 — Choose New Relic in the wizard
The wizard’s last step asks for the log source:NEWRELIC_API_KEY as the secret to fill, and asks the optional install-wide budget — NRQL queries per day (blank = no install cap; usage tracked, every cap per app). On a VM/Docker install the wizard writes to .env:
values.yaml:
NEWRELIC_API_KEY block in setup-secret.sh, which puts the key into the sariva-platform-extras Secret the chart references — the key never lands in values.yaml. (On a VM the .env value may also be file:///path or env://VAR holding the key, like the other credential references.)
Step 2 — Validate
SELECT count(*) FROM Log SINCE 5 minutes ago) through the configured key and tells you which of these you are looking at:
After a successful read it checks every registered app the same way an SRE approval does (below): lines in the last 24 h at the app’s
log_locator, which of its log_fields those lines carry, and one sample line as Sariva would show it:
log_fields is unset. On a VM the app registry lives inside the container, so add --api-url https://<your Sariva host> (with SARIVA_PLATFORM_API_KEY set): the running platform runs each app’s check and lists its usage (POST /api/v1/log-scanning/field-check, GET /api/v1/log-scanning).
sariva validate all checks only that the variables are present; it never reads. GET /api/v1/health carries a log_scanning block with the source, the period’s usage, and per app both approvals (chat_scan, monitor) with their states and caps.
Step 3 — App teams register where their logs are
Each app’s registration carrieslog_locator: the log attributes that select its lines in FROM Log — the same filter you would type into the Logs UI. Sariva builds the WHERE clause from them; nobody writes NRQL. alert_on_error_pattern entries are RE2 regular expressions (a plain word matches as a substring). Registering both posts one request for scheduled monitoring to the SRE channel; monitoring starts when an SRE replies approve (optionally approve, every 15 min, cap 5000 — an interval of 1, 5 or 15 minutes and a cap in queries per day) in that post’s thread. On-demand chat reads are a separate approval with a look-back and a daily limit, requested the first time someone asks about the app’s logs. The app-team side is on App logs & pod health.
JSON logs — tell Sariva which fields to search
New Relic parses a JSON log line into attributes. A line your app writes aslevel, event, error, … and no message attribute. Plain-text lines — for example librdkafka’s on stderr (%5|…|REQTMOUT|rdkafka#consumer-1| … Timed out OffsetCommitRequest in flight) — keep the whole line in message and have no level. One app often writes both.
So each app’s registration names the attributes to search in log_fields:
- Every pattern matches if it appears in any listed field, so JSON lines and plain-text lines are read in the same query. Matching never relies on
level; a line withoutlevelis still read. - Unset means
["message"]— right for plain-text logs, blind to JSON lines. Every SRE request post says which fields will be searched (“searches onlymessage(no log_fields set)” when unset). - Plain attribute names only (letters, digits,
.,_,-; up to 8).timestampis not a log field. - A sample line is shown as
level · <each field>:error · DeserializationError: failed to process message · Expecting value: line 1 column 1 (char 0).
log_fields on New Relic — is posted to the app’s thread and in the SRE’s approval thread, with the fix (e.g. set log_fields on payments-consumer, e.g. ["message", "event", "error"]); the approval still stands. A pass is one line naming the fields found. Changing log_fields with PUT /api/v1/apps/{alias} on an approved app runs the same check. To see an app’s attributes yourself: FROM Log SELECT * WHERE container_name = 'payments-consumer' SINCE 30 minutes ago LIMIT 5.
CloudWatch Logs needs none of this: @message holds the whole raw line, JSON or not, and log_fields is ignored there.
What it costs
Sariva does not know an app’s log volume before it reads it, so each request states the basis honestly: at the default 5-minute interval an app costs 288 NRQL queries a day (one query per interval, all patterns in it); the suggested cap is four times the estimate, rounded up, and the SRE may set any other. At 80% of its cap the app’s chat thread is warned; at 100% that app’s monitoring pauses until the next day and resumes by itself. On-demand reads count toward the app’s daily limit (50 by default, SRE-set). The optionalLOG_SCAN_BUDGET caps the whole install on top.
Switching an existing install to New Relic
SetLOG_SOURCE=newrelic plus the three NEWRELIC_* variables in .env (VM) or the logSource block in values.yaml and the Secret key (Kubernetes), restart, and run sariva validate logs. Every app’s log_locator must then name New Relic attributes — a CloudWatch log_group locator reads as no log location on New Relic and the app’s scanning stays unverified until its team updates it with PUT /api/v1/apps/{alias}. Approvals carry over.