Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse_vector VRL function? #946

Open
davidpellcb opened this issue Jul 16, 2024 · 3 comments
Open

parse_vector VRL function? #946

davidpellcb opened this issue Jul 16, 2024 · 3 comments
Labels
type: enhancement A value-adding code change that enhances its existing functionality vrl: stdlib Changes to the standard library

Comments

@davidpellcb
Copy link

davidpellcb commented Jul 16, 2024

I'm looking for a way to parse the logs emitted by Vector itself. AFAICT there isn't a parse_* function for this.

Example log:

2024-07-11T17:56:52.024579Z  WARN vector::kubernetes::reflector: Watcher Stream received an error. Retrying. error=InitialListFailed(Api(ErrorResponse { status: "Failure", message: "pods is forbidden: User \"system:serviceaccount:local-utility:vector-agent\" cannot list resource \"pods\" in API group \"\" at the cluster scope: RBAC: clusterrole.rbac.authorization.k8s.io \"vector-agent\" not found", reason: "Forbidden", code: 403 })

Is there a recommended approach for parsing Vector's logs? Just parse_grok or parse_regex? Seems like this may be hard to do. Compare this other WARN log:

2024-07-16T02:01:33.917564Z  WARN sink{component_kind="sink" component_id=proxy component_type=http}:request{request_id=1532040}: vector::sinks::util::retries: Retrying after response. reason=Http Status: 500 Internal Server Error internal_log_rate_limit=true
@jszwedko
Copy link
Member

That's true, we could add this. Typically we recommend users configure Vector to log as JSON if they want to process the logs though, by setting the environment variable VECTOR_LOG_FORMAT=json.

@jszwedko jszwedko added vrl: stdlib Changes to the standard library type: enhancement A value-adding code change that enhances its existing functionality labels Jul 16, 2024
@davidpellcb
Copy link
Author

davidpellcb commented Jul 18, 2024

VECTOR_LOG_FORMAT=json

TIL, doh, sorry for missing that. Thanks so much! I will plan to use that and we could probably close this unless you think there's any use in being able to parse the non-JSON logs.

@jszwedko
Copy link
Member

I think it's a reasonable enough request, though probably low-priority given the ability to emit structured JSON events.

@jszwedko jszwedko transferred this issue from vectordotdev/vector Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A value-adding code change that enhances its existing functionality vrl: stdlib Changes to the standard library
Projects
None yet
Development

No branches or pull requests

2 participants