Linux – Parsing log files

linuxlogssyslog

I am trying to develop a system statistics tool for Ubuntu that will store data about resource utilization of processes/users. I am storing these data in my own log files like /var/log/<process>.log. I want to know if there is any API (like procfs for collecting data about processes) for parsing my own log files using C programming language. These log files will contain simply username, process id, CPU%, MEM%, I/O etc.

Best Answer

What API would you want or need? Log files are text, use any text parsing utility, script or language that you might find useful.

Personally my language of choice tends to be awk, but that's because I am familiar with it. Though sometimes simple grep or sedsuffices.

But really it is all up to what you want to do with your logs. Possibilities are endless.

Related Question