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

[CERTTF-458] feat: use agent config in reimplemented log truncation #458

Merged
merged 6 commits into from
Feb 14, 2025

Conversation

boukeas
Copy link
Contributor

@boukeas boukeas commented Feb 6, 2025

Description

Log files are currently truncated to their last 1MB of data and that limit is hard-coded. This PR introduces a slight re-implementation of the way log files are truncated and allows the size of the truncated output log to be specified through the output_bytes agent configuration field.

The default for output_bytes when not explicitly set in the agent config is now 10MB.

Resolved issues

Resolves CERTTF-484. Note that the original task was to remove truncation altogether but making the limit parametric was deemed to be safer and more flexible.

Documentation

A paragraph was added to the section in the tutorial that discussed retrieving results. It is now explicitly stated that the results might be truncated and how the size of the truncated output log is set through the agent configuration.

Tests

Tested locally with different values for output_bytes using (variations of) this Testflinger job, which outputs random 100-character lines of output:

job_queue: myqueue
test_data:
  test_cmds: |
    for i in {1..10000}; do
        # print a random 100-character line
        tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' < /dev/urandom | head -c 100
        echo
    done

Log files were truncated to their last 1MB of data. Now
the size of the output log can be specified through the
`output_bytes` agent configuration field.
@boukeas boukeas force-pushed the CERTTF-484-log-truncation branch from 471fa53 to 9ddbeaa Compare February 6, 2025 17:28
@boukeas boukeas marked this pull request as ready for review February 6, 2025 17:34
@boukeas boukeas requested review from val500, jocave and a team February 6, 2025 17:34
val500
val500 previously approved these changes Feb 14, 2025
Copy link
Contributor

@val500 val500 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@val500 val500 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@boukeas boukeas merged commit df58923 into main Feb 14, 2025
5 checks passed
@boukeas boukeas deleted the CERTTF-484-log-truncation branch February 14, 2025 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants