The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

XAS::Lib::Modules::Log::JSON - A mixin class for logging

DESCRIPTION

This module is a mixin for logging. It creates JSON output in the logstash "json_event" format which is then logged to the logs spool directory.

METHODS

init_log

This method initializes the module. It creates a spool object for writing the "json_event".

output($hashref)

This method formats the hashref and writes out the results. The JSON data structure has the following fields:

    @timestamp     - current time in GMT
    @version       - 1
    @message       - the line that would have gone to a log file
    type           - 'xas-logs',
    message        - the log line
    hostname       - the hostname
    pid            - the pid of the process
    msgid          - message id
    priority       - the priority from -priority
    facility       - the facility from -facility
    process        - the process  from -process

destroy

This methods deinitializes the module.

SEE ALSO

XAS::Lib::Modules::Log
XAS

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

COPYRIGHT AND LICENSE

Copyright (C) 2014 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.