nelm icon indicating copy to clipboard operation
nelm copied to clipboard

Limit maximum amount of showed log lines with annotation

Open alexey-demyanov opened this issue 1 year ago • 1 comments

Description:

I would like to request the addition of an annotation that allows users to specify a maximum number of logs that can be outputted during a deployment job. This will help in managing log verbosity and preventing log overflow, which can be critical for maintaining clarity and performance during deployments.

Use Case:

In extensive deployment processes, the amount of logging information can become overwhelming and difficult to manage. This is particularly important in Continuous Integration (CI) systems like GitLab, where there are often constraints on the maximum amount of logs that a job can produce. Exceeding these limits can cause jobs to fail or logs to be truncated, making it harder to diagnose issues. Having a mechanism to limit the amount of logs will ensure that only the most critical information is logged, making it easier for developers and operators to troubleshoot issues without sifting through excessive log data.

Requested Annotation Example:

Copy Code
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
  annotations:
    werf.io//max-logs: "1000"
spec:
  # Deployment specification

Expected Behavior:

When the annotation werf.io/max-logs is set on a deployment, the job responsible for deploying should limit the logs outputted to the specified number.

Any logs beyond the specified limit should be truncated or skipped.

Benefits:

Enhanced manageability of logs during deployments.

Improved performance due to reduced log clutter.

Easier identification and resolution of issues.

Better compatibility with CI systems like GitLab that have log size constraints.

Conclusion:

Adding this annotation will significantly improve the usability and efficiency of deployment processes, particularly in large-scale environments where log management is crucial. This feature will provide better control over log outputs and help maintain clearer and more concise logging practices.

Thank you for considering this feature request!

alexey-demyanov avatar Aug 14 '24 12:08 alexey-demyanov

Should be noted that there are quite some annotations to limit log output, namely: Annotation werf.io/log-regex Annotation werf.io/log-regex-for-<container_name> Annotation werf.io/skip-logs Annotation werf.io/skip-logs-for-containers Annotation werf.io/show-logs-only-for-containers

Although werf.io/max-logs might make sense too.

ilya-lesikov avatar Mar 31 '25 15:03 ilya-lesikov