FW:10280+
The FMADIO Push PCAP function is a great way to export data to downstream systems. However where the PCAP is transferred to (remote or local) the disk storage can end up consuming and filling up the entire drive.
By default FMADIO does not rotate the files or manage the size of the directory. Typically its the downstream application which will monitor and delete files appropriately, e.g. when the PCAP has been successfully transferred off the system, it can be deleted.
In some cases its preferred the FMADIO system will delete these PCAPs. This example shows how to configure automatic deletion of PCAP files.
Step 1) Create a configuration file
Create a configuration file in
/opt/fmadio/etc/pcap_rotate.lua
This specifies the directory and maximum file size of all data in that directory. An example is shown below
local Config = {}
-- list directories to cycle
table.insert(Config,
{
Path = "/mnt/remote0/pcap/",
MaxByte = 1e12,
})
return Config
In the above example, the system will monitor the contents of /mnt/remote0/pcap
and ensure the maximum directory size does not exceed 1TB (1e12 bytes).
This path could be a remote NFS path (such as above) or a local path such as /mnt/store1/pcap
on the system itself.
Multiple directories can be specified with different maximum byte sizes.
Step 2) Confirm no syntax errors in configuration file
To confirm the syntax of the configuration file run
fmadiolua /opt/fmadio/etc/pcap_rotate.lua
A correct output looks like the following below
fmadio@fmadio20v2-149:~$ fmadiolua /opt/fmadio/etc/pcap_rotate.lua
fmad fmadlua Nov 18 2024 (fmadiolua /opt/fmadio/etc/pcap_rotate.lua )
Cycles/Sec 2100010596.0000 Std: 0 cycle std( 0.00000000) Target:2.10 Ghz
failed to open self? [fmadiolua]
done 0.000046Sec 0.000001Min
fmadio@fmadio20v2-149:~$
Step 3) Enable on the scheduler
Enable the rotation in the GUI as follows, see the row highlighted in red. Analytics Engine is
pcap_rotate
In this example its run 24/7
Step 4) Finish
System will now monitor the directory and try maintain the target disk usage
Debug
Debug logs can be found in the following location
/mnt/store0/log/analytics_pcap_rotate.cur