awslabs / awslabs/flowgger

Log file naming hardcode the time and extensions separators

Open
#64 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
879
Forks
61
PR merge metrics
No merged PRs in 30d

Description

In [log file name](https://github.com/awslabs/flowgger/blob/master/src/flowgger/utils/rotating_file.rs#L128) the separator with the datetime string and the extension strings are hardcoded.

So, using another char than "-" or no extension doesn't work.

```
file_path = "var/output/logs/fwsyslog.log"
file_rotation_timeformat = ".%Y-%m-%d-%H-%M"
file_rotation_time = 60

# want fwsyslog.2021-12-17-15-06.log
# get fwsyslog-.2021-12-17-15-39.log
```

```
file_path = "var/output/logs/fwsyslog"
file_rotation_timeformat = ".%Y-%m-%d-%H-%M"
file_rotation_time = 60

# want fwsyslog.2021-12-17-15-06
# get fwsyslog-.2021-12-17-15-39.log
```

Update ```new_file.set_file_name(&format!("{}-{}.{}"```
- The datetime separator must be removed and put in the config string.
- The ".{}" suffix should only be appended if the filename contains a suffix

Contributor guide

Open the contributing guide

Research direction

Start at src/flowgger/utils/rotating_file.rs#L128 and inspect how new_file.set_file_name formats rotated paths. Compare the two configuration examples in the issue, including custom datetime separators and paths with or without extensions. Done means the generated names match the requested examples without adding a hardcoded separator or suffix.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
observability
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.