Last active
August 29, 2015 14:08
-
-
Save sowamazing/54e34cf148230362d52e to your computer and use it in GitHub Desktop.
Sending JSON Format Logs From Syslog-ng - Snippet 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source s_apache { | |
file("/var/log/apache2/spike2-access.log" flags(no-parse)); | |
}; | |
parser p_apache { | |
csv-parser(columns("APACHE.CLIENT_IP", "APACHE.IDENT_NAME", "APACHE.USER_NAME", | |
"APACHE.TIMESTAMP", "APACHE.REQUEST_URL", "APACHE.REQUEST_STATUS", | |
"APACHE.CONTENT_LENGTH", "APACHE.REFERER", "APACHE.USER_AGENT", | |
"APACHE.PROCESS_TIME", "APACHE.SERVER_NAME") | |
flags(escape-double-char,strip-whitespace) | |
delimiters(" ") | |
quote-pairs('""[]') | |
); | |
}; | |
template LogglyFormat { template("<${PRI}>1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} ${MSGID} [abcd1234-aaaa-bbbb-1234-1234abcd1234@41058] $(format_json --key APACHE.*)\n");}; | |
destination d_loggly { | |
tcp("logs-01.loggly.com" port(6514) | |
tls(peer-verify(required-untrusted) ca_dir('/etc/syslog-ng/keys/')) | |
template(LogglyFormat)); | |
}; | |
log { source(s_apache); parser(p_apache); destination(d_loggly); }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment