nacctd(8)

πŸ¦‹ nacctd(8) β€” network accounting daemon πŸ¦‹

okay so bestie, meet nacctd πŸ’– the little daemon that literally watches your network traffic and writes down receipts. No cap, it's giving billing-department main character energy. Let's get into it ✨


πŸŽ€ NAME πŸŽ€

nacctd β€” network accounting daemon


🌸 SYNOPSIS 🌸

nacctd [-dD] [-c filename]

✨ DESCRIPTION ✨

The network accounting daemon logs network traffic in a format suitable for generating billing information or usage statistics. So like, if you ever wanted to know who owes you money for the bytes, this is her πŸ’…

nacctd listens on network interfaces and periodically writes information to a log file. Periodically. Like, she's not spammy about it, she's got a schedule 🫢

And how do you configure her? By editing her configuration file, /etc/nacctd.conf. That's it, that's the whole vibe check πŸ‘‘


πŸ’œ OPTIONS πŸ’œ

  • -d β€” this will let nacctd run in debug mode πŸ›
  • -D β€” this will make nacctd not detach as a daemon, which is suitable for running it from inittab 🌈
  • -c configfile β€” specify the path of an alternative config file πŸ“

πŸ“ CONFIGURATION FILE OPTIONS πŸ“

bestie this is the whole personality section, pay attention πŸ’–

  • flush <n> β€” flush every n seconds. This gives the interval in seconds when the accumulated data is flushed to the output file. Typically set to 300 (five minutes) ⏰
  • fdelay <n> β€” this defines after how many seconds of inactivity a certain record of traffic information may be written out. This helps making the log files smaller since only one output record will be generated for related traffic. Typically set to 60 seconds. It's the "okay are you DONE talking" timer 😭
  • file <f> β€” specifies the main output file for the daemon to log network traffic to πŸ“
  • dumpfile <f> β€” specifies a file to dump data to that is not yet written to the main output file. This is to prevent data loss should a crash occur πŸ’€ On startup an existing file of this name will be moved to <f>.o
  • notdev <interface> β€” don't log entries for this interface 🚫
  • device <interface> β€” specifies a network interface to put into promiscuous mode πŸ‘€ (she's nosy, on purpose)
  • iflimit <interface> β€” log only packets on this interface. Mutually exclusive with hostlimit βš”οΈ
  • ignoremask <netmask> β€” specifies a netmask (in dotted quad format) for which traffic is ignored. This allows traffic on the local LAN to be excluded 🏠
  • ignorenet <network> <netmask> β€” ignore traffic on this network. Ignoring a net with ignorenet is not as efficient as ignoremask. Thus you should exclude your local network with ignoremask in preference to ignorenet ⚑
  • masqif <ipaddr> β€” specifies an ip number we are masquerading as. This re-maps ip/port for incoming connections (e.g. FTP-data) to ip/port of the masqueraded destination 🎭
  • debug <n> β€” sets the debugging level to n 🐞
  • headers <interface-type> <data-start> <type-field> β€” defines where the real data starts for each type of interface. <interface-type> is one of eth, lo, plip, isdn etc. <data-start> is the offset in bytes to the start of the real data. <type-field> is the offset of the type field in bytes, or a 0 if there is no type field. If SLIP or PPP devices are specified here, association of dynamic ip addresses with usernames won't work (see dynamicip below) ⚠️
  • dynamicip <dir> β€” specifies a directory to get username information from, where users are logged into ppp or slip accounts and assigned dynamic ip addresses. The directory should contain a file for each logged in user, where the filename is their IP address, and the file contains their username. Typically, these files will be created by ip-up scripts 🧚
  • dynamicnet <network> <netmask> β€” specifies the network the slip/ppp dynamic ips are assigned from 🌐
  • exclude-name-lookup <network> <netmask> β€” specifies a (sub)net to exclude from dynamic ip name lookup πŸ™ˆ
  • hostlimit <ipaddr> β€” log only packets to/from this host. This may be specified multiple times for multiple hosts. This option is mutually exclusive with iflimit βš”οΈ
  • disable <n> β€” don't include field n in the output format βœ‚οΈ
  • dontignore <network> <netmask> β€” don't ignore hosts on the specified (sub)net that would otherwise have been excluded by an ignorenet statement. This can be a useful to account for proxy traffic by specifying the proxy servers' subnet 🫢
  • line <interface> <device> β€” specifies fixed mapping of slip/ppp interface names to tty devices. This is used to assign traffic to a user if nacctd runs on the ppp/slip server and the relation between network interface and serial line is fixed. This option is obsolete πŸ‘΅

🌈 OUTPUT FILE FORMAT 🌈

The output file consists of lines with up to 10 fields, or less if the configuration file disables one or more fields. (Hey, that's what disable <n> was for 😌)

timestamp protocol src-addr src-port dst-addr dst-port count size user interface
  • timestamp β€” time in seconds past the epoch (standard UNIX time format) πŸ•°οΈ
  • protocol β€” IP protocol
  • count β€” count of packets
  • size β€” size of data
  • user β€” associated user in case of a slip/ppp link, this will always be "unknown" for other interfaces 🀷

If the type is an ICMP message, field 4 is the ICMP message type and field 6 is the ICMP message code πŸ“¨

⚠️ Please note that for forwarded packets there will be one line for EACH interface the packet passed. So if you are running this on your slip-server you will get all the traffic over the slip interfaces TWICE, once for the sl* devices and once for the eth* device. The same goes for ppp and generally for all forwarded traffic. You can specify with notdev entries which interfaces you don't want to see in the log. fr fr, double the lines, double the chaos 😭

πŸ’– FILES πŸ’–

  • /etc/nacctd.conf β€” configuration file
  • /var/log/net-acct β€” default location for the main output file
  • /var/log/net-acct-dump β€” default location for the dump of data not yet written to the main file

🫢 SEE ALSO 🫢

/usr/share/doc/net-acct/*, tcpdump(8), trafshow(1).


πŸ™ˆ CAVEATS πŸ™ˆ

This manual page is incomplete, and possibly inaccurate. Not me telling on myself but okay πŸ’€


πŸ‘‘ AUTHORS πŸ‘‘

  • Ulrich Callmeier
  • Richard Clark <rclark@ethos.co.nz>
  • This manual page was written by Alex King <alex@king.net.nz>, for the Debian GNU/Linux system, using material from the original documentation πŸ’œ

okay that's the whole page bestie, you're officially certified in network accounting πŸ’…βœ¨ and yeah, this one's dated 16 Dec 2001, from the System Manager's Manual β€” vintage, iconic, a classic πŸŽ€ go forth and log some traffic, mwah πŸ¦‹

πŸ“¦ where this page comes from