Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <fcntl.h>
- #include <unistd.h>
- int main( int argc, char *argv[] ) {
- char buf[1024];
- int fd, buflen,lineas=0,i=0;
- fd = open("/var/log/snort/alert.fast",O_RDONLY);
- lseek( fd, 0 - sizeof(buf), SEEK_END);
- for ( ;; ) {
- buflen = read(fd, buf, sizeof(buf));
- for ( i=0; i<buflen;i++){
- if ( buf[i] == '\n' ) {
- lineas++;
- }
- }
- if ( buflen > 0 ){
- // printf("%s",buf);
- printf("Lineas/s: %d\tBuffer: %d\r", lineas,buflen);
- fflush(stdout);
- lineas = 0;
- }
- lseek(fd, buflen, SEEK_CUR);
- sleep ( 1 );
- }
- close(fd);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement