Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. // gcc giuspexample.c -o giuspexample
  2.  
  3. #include <syslog.h>
  4.  
  5. int main()
  6. {
  7. setlogmask(LOG_UPTO (LOG_NOTICE));
  8.  
  9. openlog("atm", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL0);
  10.  
  11. syslog(LOG_NOTICE, "Program started by User %d", getuid ());
  12. syslog(LOG_INFO, "A tree falls in a forest");
  13.  
  14. closelog();
  15. return 0;
  16. }
  17.  
  18. echo "local0.* /var/log/mylog" >> /etc/syslog.conf
  19.  
  20. sudo /etc/init.d/syslog restart
  21.  
  22. # Log QSD Centro generated log messages to file
  23. if $programname == 'centro' then /var/log/centro.log
  24. # Uncomment the following to stop logging anything that matches the last rule.
  25. & ~
  26.  
  27. sudo rm -f /var/log/centro.log
  28.  
  29. sudo service rsyslog restart
  30.  
  31. // gcc centro.c -o centro
  32.  
  33. #include <stdio.h>
  34. #include <syslog.h>
  35.  
  36. int main(int argc, char *argv[])
  37. {
  38. openlog(NULL, 0, LOG_USER);
  39.  
  40. syslog(LOG_INFO, "MORTACCI TUA!!!");
  41.  
  42. closelog();
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement