This repository is no longer being actively maintained. We encourage you to not use this code. If you rely on this code you might want to fork the repository to keep your systems from breaking, if we remove this repository in the future.
A heka decode written in lua for parsing symfony2 formatted monolog messages
You can place the lua decoders anywhere as long as heka can read them.
There are two decoders available. One for decoding log messages in your
app/logs directory and another one that decodes monolog messages that were
logged to syslog (useful if you configured your Symfony 2 application to log
to syslog).
To use the plain Symfony2 Monolog Decoder put the following in your
/etc/hekad.toml:
$ cat /etc/hekad.toml
[Symfony2MonologFileInput]
type = "LogstreamerInput"
log_directory = "/var/www/app/logs"
file_match = 'prod\.log'
decoder = "Symfony2MonologDecoder"
[Symfony2MonologDecoder]
type = "SandboxDecoder"
filename = "/etc/symfony2_decoder.lua"
Adjust log_directory and filename according to your setup.
To use the Syslog Symfony2 Monolog Decoder you need to configure your
symfony2 application to log to syslog by changing config_prod.yml:
$ cat app/config/config_prod.yml
# ...
monolog:
handlers:
main:
type: syslog
ident: myapplication
# ...
And configure rsyslog to send all logs with application name myapplication
to a seperate file:
$ cat /etc/rsyslog.d/90-myapplication.conf
if $programname == 'myapplication' then /var/log/myapi.log
Where programname and ident are the same string.
Now you can configure heka to watch this file:
$ cat /etc/hekad.toml
[SyslogSymfony2MonologFileInput]
type = "LogstreamerInput"
log_directory = "/var/log"
file_match = 'bmpapi\.log'
decoder = "SyslogSymfony2MonologDecoder"
[SyslogSymfony2MonologDecoder]
type = "SandboxDecoder"
filename = "/etc/syslog_symfony2_decoder.lua"
[SyslogSymfony2MonologDecoder.config]
type = "RSYSLOG_TraditionalForwardFormat"
template = '%TIMESTAMP% %HOSTNAME% %syslogtag:1:32%%msg:::sp-if-no-1st-sp%%msg%'
tz = "Europe/Amsterdam"
For debugging purposes you can use the build-in RstEncoder to see how the
fields get serialized:
$ cat /etc/hekad.toml
# ...
[RstEncoder]
[LogOutput]
message_matcher = "TRUE"
encoder = "RstEncoder"
# ...
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
apache 2.0 -- see LICENSE for more details.