mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-17 17:44:09 +01:00
Merge pull request #958 from tdurieux/fix/preserve-log-event-field
fix: preserve searchable event fields in collected logs
This commit is contained in:
3 files changed
+8
-1
No files matched your search
@@ -58,4 +58,6 @@ for_each(["status", "httpStatus", "ms", "firstByteMs", "responseMs", "bytes", "b
|
||||
}
|
||||
if includes(["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "OTHER"], record.method) { out.method = record.method }
|
||||
if includes(["/", "other", "/dashboard", "/anonymize", "/healthcheck", "/api/healthcheck", "/api", "/api/download", "/api/stat", "/api/stat/history", "/api/options", "/api/message", "/api/user", "/api/user/quota", "/api/user/dashboard", "/api/repo", "/api/anonymize-preview", "/api/admin/overview", "/api/admin/performance", "/api/admin/errors", "/api/admin/errors/stats", "/api/admin/queues", "/api/admin/queues/metrics", "/github/app/webhook", "/api/repo/:repoId", "/api/repo/:repoId/file/:path", "/api/repo/:repoId/files", "/api/repo/:repoId/files/counts", "/api/repo/:repoId/files/search", "/api/repo/:repoId/zip", "/api/repo/:repoId/options", "/api/repo/:repoId/refresh", "/api/repo/:repoId/coauthors", "/api/repo/:repoId/extend", "/api/repo/:owner/:repo/readme", "/api/repo/:owner/:repo/branches", "/w/:repoId/:path", "/r/:repoId/:path", "/api/pr/:id/:path", "/api/gist/:id/:path", "/assets/:path", "/github/:action", "/api/admin/:action", "/api/user/:action", "/api/repo/:id/file/:path", "/api/repo/:id/files/counts", "/api/repo/:id/files/search", "/api/repo/:id/files", "/api/repo/:id/zip", "/api/repo/:id", "/viewer/:id/:path"], record.route) { out.route = record.route }
|
||||
# VictoriaLogs consumes its message field; keep event independently searchable.
|
||||
out._msg = out.event
|
||||
. = out
|
||||
@@ -34,7 +34,7 @@ sinks:
|
||||
compression: gzip
|
||||
healthcheck: {enabled: false}
|
||||
query:
|
||||
_msg_field: event
|
||||
_msg_field: _msg
|
||||
_time_field: timestamp
|
||||
_stream_fields: service,severity
|
||||
batch: {max_bytes: 1048576, timeout_secs: 1}
|
||||
|
||||
@@ -115,6 +115,10 @@ with tempfile.TemporaryDirectory(prefix=PROJECT) as temp:
|
||||
correlated = query('requestId:="' + request_id + '"')
|
||||
assert {r['service'] for r in correlated} == {'api', 'streamer', 'worker', 'nginx'}
|
||||
assert len(query('jobId:="' + job_id + '"')) == 1
|
||||
assert {r['event'] for r in correlated} == {'request_completed', 'job_failed', 'edge_request'}
|
||||
assert all(r['_msg'] == r['event'] for r in correlated)
|
||||
assert len(query('event:request_completed')) == 2
|
||||
assert len(query('event:job_failed')) == 1
|
||||
assert all('requestId' not in r['_stream'] and 'instance' not in r['_stream'] for r in rows)
|
||||
print('PASS ingestion, privacy allowlist, malformed input, API/streamer/job/edge correlation')
|
||||
# Query every shipped dashboard and alert expression against the real server.
|
||||
@@ -155,6 +159,7 @@ with tempfile.TemporaryDirectory(prefix=PROJECT) as temp:
|
||||
wait_for(lambda: get(vector, '/metrics'))
|
||||
before = count()
|
||||
append('api', {'event': 'process_heartbeat', 'severity': 'info'})
|
||||
wait_for(lambda: len(query('event:process_heartbeat')) >= 1)
|
||||
wait_for(lambda: count() > before)
|
||||
print('PASS rename rotation and collector checkpoint restart')
|
||||
# Backend failure: sanitized disk spool remains bounded; source writer stays independent.
|
||||
|
||||
Reference in new issue
Block a user