Hi, I believe that the easiest way is using the json output over a linux pipe, or if you prefer over stdin/stdout, which eventually behave like a pipe. Here an example with pipe:
Python script: if __name__ == '__main__': os.mkfifo(path_to_fifo, mode=0o666) while True: # One loop == one *acct flush with open(path_to_fifo) as fifo: timestamp = time.time_ns() # Read *acct records from fifo line by line for line in fifo: buffer = process_json_record(line, timestamp) # Process *acct flush process_buffer(buffer) Nfacct config (only relevant parts): print_output: json print_output_file_append: true print_write_empty_file: false plugins: print[json] print_output_file[json]: path_to_fifo Cheers, luca > Il giorno 3 mag 2022, alle ore 20:19, Compton, Rich A > <rich.comp...@charter.com> ha scritto: > > Hi, I’m trying to take the netflow records from nfacctd and process them with > a python script. Can someone suggest how I can do this with python without > having nfacctd put them into a database and then have my python script read > it? Is using kafka the best way? The netflow collection and python script > will be on the same instance. Any example code would be very helpful! > Thanks! > > <image001.png> > > Rich Compton | Principal Eng | 314.596.2828 > 8560 Upland Drive, Suite B | Englewood, CO 80112 > PGP Key > <https://keys.openpgp.org/vks/v1/by-fingerprint/34796C9780F5A45110C2E757058D383616AF9497> > > The contents of this e-mail message and > any attachments are intended solely for the > addressee(s) and may contain confidential > and/or legally privileged information. If you > are not the intended recipient of this message > or if this message has been addressed to you > in error, please immediately alert the sender > by reply e-mail and then delete this message > and any attachments. If you are not the > intended recipient, you are notified that > any use, dissemination, distribution, copying, > or storage of this message or any attachment > is strictly prohibited. > _______________________________________________ > pmacct-discussion mailing list > http://www.pmacct.net/#mailinglists
_______________________________________________ pmacct-discussion mailing list http://www.pmacct.net/#mailinglists