Skip to content

fix: pcap file name formatting#1749

Merged
kamilprz merged 4 commits into
microsoft:mainfrom
kamilprz:kamilp/capture-filename-format
Jul 28, 2025
Merged

fix: pcap file name formatting#1749
kamilprz merged 4 commits into
microsoft:mainfrom
kamilprz:kamilp/capture-filename-format

Conversation

@kamilprz

Copy link
Copy Markdown
Contributor

Description

Fix the bad formatting of the pcap file names when running retina capture create.

Also adding testing for the utilities around how file names are created.

Related Issue

#1732

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

{D77C22CD-6FFA-44A0-B15B-B89E4542A2A2}

The below shows a successful download of a packet capture which is then extracted. The final grep shows the file name of the .pcap which is in the same format as the .tar.gz.

~/src/retina git:kamilp/capture-filename-format
> k retina capture download --name pcap-filename -o ./downloads

File to be downloaded:  /host/mnt/retina/captures/pcap-filename-aks-agentpool-33289083-vmss000000-20250716220911UTC.tar.gz
Creating download pod: pcap-filename-download-d49wc
Obtaining file...
Bytes retrieved: 189453
File written to:  downloads/pcap-filename/pcap-filename-aks-agentpool-33289083-vmss000000-20250716220911UTC.tar.gz

File to be downloaded:  /host/mnt/retina/captures/pcap-filename-aks-agentpool-33289083-vmss000001-20250716220911UTC.tar.gz
Creating download pod: pcap-filename-download-t86dl
Obtaining file...
Bytes retrieved: 277310
File written to:  downloads/pcap-filename/pcap-filename-aks-agentpool-33289083-vmss000001-20250716220911UTC.tar.gz
                                                                                                                               ~/src/retina git:kamilp/capture-filename-format*
> cd ./downloads/

~/src/retina/downloads git:kamilp/capture-filename-format*
> mkdir extract

~/src/retina/downloads git:kamilp/capture-filename-format*
> tar -xvf pcap-filename/pcap-filename-aks-agentpool-33289083-vmss000001-20250716220911UTC.tar.gz -C extract/

~/src/retina/downloads git:kamilp/capture-filename-format*
> cd extract/                                                                                                                    

~/src/retina/downloads/extract git:kamilp/capture-filename-format*
> ll | grep ".pcap"
.rw-r--r-- kamilp 557 KB 2025-07-16 23:09:23 pcap-filename-aks-agentpool-33289083-vmss000001-20250716220911UTC.pcap

kamilprz added 3 commits July 16, 2025 20:59
Signed-off-by: Kamil <kamil.prz@gmail.com>
Signed-off-by: Kamil <kamil.prz@gmail.com>
Signed-off-by: Kamil <kamil.prz@gmail.com>
@kamilprz kamilprz requested a review from a team as a code owner July 16, 2025 22:16
Signed-off-by: Kamil <kamil.prz@gmail.com>
Comment thread pkg/capture/file/timestamp.go

@SRodi SRodi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment thread pkg/capture/file/timestamp.go
@kamilprz kamilprz added this pull request to the merge queue Jul 18, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 18, 2025
@nddq nddq linked an issue Jul 18, 2025 that may be closed by this pull request
@kamilprz kamilprz added this pull request to the merge queue Jul 28, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 28, 2025
@kamilprz kamilprz added this pull request to the merge queue Jul 28, 2025
Merged via the queue into microsoft:main with commit 335c6db Jul 28, 2025
31 checks passed
@kamilprz kamilprz deleted the kamilp/capture-filename-format branch July 28, 2025 11:45
mereta pushed a commit that referenced this pull request Dec 2, 2025
# Description

Fix the bad formatting of the pcap file names when running `retina
capture create`.

Also adding testing for the utilities around how file names are created.

## Related Issue

#1732

## Checklist

- [x] I have read the [contributing
documentation](https://retina.sh/docs/Contributing/overview).
- [x] I signed and signed-off the commits (`git commit -S -s ...`). See
[this
documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification)
on signing commits.
- [x] I have correctly attributed the author(s) of the code.
- [x] I have tested the changes locally.
- [x] I have followed the project's style guidelines.
- [x] I have updated the documentation, if necessary.
- [x] I have added tests, if applicable.

## Screenshots (if applicable) or Testing Completed

<img width="450" height="47"
alt="{D77C22CD-6FFA-44A0-B15B-B89E4542A2A2}"
src="https://github.com/user-attachments/assets/306fa604-0162-49c8-bb07-0645df04ea84"
/>

The below shows a successful download of a packet capture which is then
extracted. The final grep shows the file name of the `.pcap` which is in
the same format as the `.tar.gz`.

```
~/src/retina git:kamilp/capture-filename-format
> k retina capture download --name pcap-filename -o ./downloads

File to be downloaded:  /host/mnt/retina/captures/pcap-filename-aks-agentpool-33289083-vmss000000-20250716220911UTC.tar.gz
Creating download pod: pcap-filename-download-d49wc
Obtaining file...
Bytes retrieved: 189453
File written to:  downloads/pcap-filename/pcap-filename-aks-agentpool-33289083-vmss000000-20250716220911UTC.tar.gz

File to be downloaded:  /host/mnt/retina/captures/pcap-filename-aks-agentpool-33289083-vmss000001-20250716220911UTC.tar.gz
Creating download pod: pcap-filename-download-t86dl
Obtaining file...
Bytes retrieved: 277310
File written to:  downloads/pcap-filename/pcap-filename-aks-agentpool-33289083-vmss000001-20250716220911UTC.tar.gz
                                                                                                                               ~/src/retina git:kamilp/capture-filename-format*
> cd ./downloads/

~/src/retina/downloads git:kamilp/capture-filename-format*
> mkdir extract

~/src/retina/downloads git:kamilp/capture-filename-format*
> tar -xvf pcap-filename/pcap-filename-aks-agentpool-33289083-vmss000001-20250716220911UTC.tar.gz -C extract/

~/src/retina/downloads git:kamilp/capture-filename-format*
> cd extract/                                                                                                                    

~/src/retina/downloads/extract git:kamilp/capture-filename-format*
> ll | grep ".pcap"
.rw-r--r-- kamilp 557 KB 2025-07-16 23:09:23 pcap-filename-aks-agentpool-33289083-vmss000001-20250716220911UTC.pcap

---------

Signed-off-by: Kamil <kamil.prz@gmail.com>
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.

Retina capture .pcap filename formatting

2 participants