Is there a way to set wireshark to automatically delete capture data that is older than a given time? For example, I would like to have wireshark constantly running, but I don't have unlimited storage space, so I would just like to see the data for the past 12 hours. I check my computer more than once every 12 hours, so if I see something strange happening, or if I want to see my packet history due to some recent event, I could do so and save the important parts if I wish. asked 13 Feb '11, 08:39 1proof |
2 Answers:
Or to give an example, you can make a ringbuffer with dumpcap as follows:
This will create files of 900 seconds each, but after creating 48 files, it will remove the first one. Effectively it will keep 12 hours of data. When you create new files based on time, you still might run out of diskspace if network traffic is unusually high. I always prefer something like the following:
Which will create files of 16MB and it will keep only the last 1024 of them, so you know the capture buffer will never grow beyond 16GB. You can use capinfos to show which file contains which timeframe like so:
If you need to combine data of multiple of these files, you can use mergecap to combine them:
This will combine file1 to fileX into the new file Last but not least, you can use editcap to get a certain time interval from the resulting tracefile with:
Which will create a file All used commands are included with Wireshark :-) answered 13 Feb '11, 11:49 SYN-bit ♦♦ |
Look into using the ringbuffer options. And for long running capture, use dumpcap i.s.o. wireshark. answered 13 Feb '11, 11:19 Jaap ♦ |
I think it's about time we get a new badge called "command line hero" for Sake :-)
Thanks a lot for the reply! I'm new to wireshark, so I'm sure this was a very elementary problem for you.
I used dumpcap -i <interface> -w <file.pcap> -b files:1024 -b filesize:16384 as you said
So far its working well...
In case someone doesn't know, In windows you can get the proper name for <interface> by using dumpcap -D
I'm glad this works for you. If my answer did answer your question, you can click on the "checkmark" on the left of it (below the thumps-down) to accept the answer so the question will not appear in the "Unanswered" list anymore.
BTW I changed your "answer" to a "comment" to adhere to the Q&A style of this website.