Skip to content

Instantly share code, notes, and snippets.

View slashdoom's full-sized avatar

Slashdoom slashdoom

View GitHub Profile
@slashdoom
slashdoom / syslog.py
Last active August 29, 2015 14:18
Template for Python based external syslog-ng log parser
#!/usr/bin/env python
import sys
PYTHONUNBUFFERED = "true"
try:
for line in sys.stdin:
# do stuff with line
@slashdoom
slashdoom / syslog.php
Last active August 29, 2015 14:18
Template for PHP based external syslog-ng log parser
#!/usr/bin/env php
<?php
# open stdin
$s = fopen('php://stdin','r');
# check stdin for new logs
while ($input = fgets($s)) {
# do stuff with $input
}