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

graylog - Command line script to send data to a Graylog2 server

VERSION

version 0.3

SYNOPSIS

    graylog -m "sending a basic message"

DESCRIPTION

Send a message to a graylog2 analysis server, sent using GELF format over HTTP.

You may send any data to a gray log server, but there are some restrictions plus this module adds some defaults.

* There must be a message field

* a level field will be interpreted as a syslog level and converted to a number

    * you can access the original value with the levelstr field

* timestamp and timestr field are added, the former is a unix int timestamp, the latter a time string

* each message gets a uuid

* a server field will be reinterpreseted as a host field, a default of hostname() will be added if needed

NAME

graylog

Help

    graylog --help

    Syntax: graylog [options] [optional] key:value pairs='of information'

    About:  Send messages to a graylog server

    [options]
        --config        Config file to use [DEFAULT: $HOME/.graylog.cfg]
        --facility      Syslog facility level one of kern, user, mail, daemon, auth, syslog, lpr, news, uucp, clock, authpriv, ftp, ntp, audit, alert, cron, local0, local1, local2, local3, local4, local5, local6, local7
        --help          Show help
        --level         Syslog severity level one of emerg, alert, crit, error, warning, notice, info, debug
        --logger        The name of the logger to report [DEFAULT: graylog]
        --long          Optional long message to additionally send
        --message*      The message to send
        --server        The name of the server to report this message came from
        --target        target to send messages to, either url or name of item in config file
        --verbose       Dump extra useful information
    * required option

Config file settings

The config file is a YAML file in $HOME/graylog.cfg

    ---
    # config file for graylog
    # default should match an entry in the targets

    default: local
    targets: 
        local: 'http://localhost:12202/gelf'
        server2: 'http://server2:12202/gelf'
        server3: 'http://server3:12202/gelf'

Set default to one of the targets. The targets are the URLs of graylog servers that you have access to

AUTHOR

 kevin mulholland

VERSIONS

v0.1 2014/03/19, initial work

Notes

Obviously if you just want oto do this on the command line you can use

curl -XPOST http://graylog2_server:12202/gelf -p0 -d '{"short_message":"Hello there", "host":"example.org", "facility":"test", "_foo":"bar"}'

See Also

Log::Log4perl::Layout::GELF , Net::Sentry::Client

AUTHOR

Kevin Mulholland <moodfarm@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Kevin Mulholland.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.