30 Dec 2011

PyLogagent


I wrote a small python logging agent to work around with application log files which cannot be logged to central log server (Syslog-Ng)

Source code is available on Github
----
Some log files generated by application cannot be logged to syslog/syslog-ng

pylogagent will watch list of log files in "configuration" file, then push new lines to /dev/log socket with prefix.

USAGE:
1. Set up syslog-ng server to listen for log
----snip-----
source net {
udp(ip(ip_of_log_server) port(514));
};
destination nginx_error {
file("/data/log/$HOST_FROM/$YEAR/$MONTH/$DAY/nginx_error");
};
filter nginx_error {
match("^nginx_error");
};
log {source(net);filter(nginx_error);destination(nginx_error;};
-----snip-----

These line above will make syslog-ng server listen for log on udp port 514, whenever a log stream deliver to its port, syslog-ng will parse, look for regex ^nginx_error, if it is found, log to file nginx_error.


1. Configure which log files pylogagent will watch

#configuration
/data/log/nginx_error.log

2. Start logagent
# python agent 

3. Configure syslog-ng client

------snip--------
source s_local {
internal();
unix-stream("/dev/log");
};
destination d_loghost {
udp("ip_of_log_server" port(514));
};
filter nginx_error            {
match("^nginx_error");
};
log {
source(s_local);
filter(nginx_error);
destination(d_loghost);
};

------snip--------

Restart syslog-ng and you are done.
Tail log file on central log to see how it works ;)



--
More will be added later

12 Dec 2011

Python for Informatics: Exploring Information

If you're looking for the way learning Python on your own, and still can't find a good document, book or lecturer, this online course should be a right choice.

The goal of this site is to provide a set of materials to allow you to learn Python on your own. This page serves as an outline of the materials to support the textbook "Python for Informatics: Exploring Information". The materials are focused on the "core-programming skills" contained in Chapters 1-10. The slides, video lectures, and worked exercises are prepared specifically for online use. The "Lecture Audio" is recorded from the SI502 - Networked Computing course at the University of Michigan 

http://prezage.com/player/?p=40


Disqus