I've written the following systemd service tcpdumpd.service
to kick off a persistent tcpdump recording.
[Unit]
Description=TCPDumpd
After=multi-user.target network.target
[Service]
Type=simple
ExecStart=/usr/sbin/tcpdump -pni eth0 -s65535 -G 3600 -w '/var/log/tcpdump/trace_%Y-%m-%d_%H:%M:%S.pcap' -z gzip
Restart=on-abort
[Install]
WantedBy=multi-user.target
tcpdump allows strftime-placeholders like %H for hour, %M for minute and so on to allow you to create time stamped files.
However, systemd has special specifiers than can be used in it, like (%n, %N, %p, %i, %U, %u, %m, %H, %b, %v) So any of the specifiers that overlap, like %m and %H pass through the information from systemd and don't allow the placeholder to be passed through to tcpdump to make the time stamp.
Does anyone know if there is a way to escape the specifiers in systemd so I can pass the %m and %H through to tcpdump?