pye - Inspect logs generated by Pye
In the command line:
# show list of latest 10 sessions $ pye -b MongoDB # show complete log for a specific session ID (say "123") $ pye -b MongoDB -S 123 # log a message for a specific session ID (say "123") with complex data $ pye -b MongoDB -S 123 -m "some log message" -D '{ "some": "data" }'
pye is a command line utility for reading and inspecting logs generated by the Pye logging system. It allows viewing sessions in the log, reading the entire log of a session, and even adding messages and data to the log.
pye
The utility is meant to be used via shell aliases specific to a certain application and/or backend, to make it fast and easy to view the log. For example, say I have an application called "myapp", and another one called "myscript", which save logs to the same MongoDB database running on a remote server, but to different collections. I might create the following bash aliases:
alias myapplog='pye -b MongoDB -d logs -c myapp_logs -H logserver' alias myscriptlog='pye -b MongoDB -d logs -c myscript_logs -H logserver'
Then, I can easily inspect the log:
myapplog # will list latest sessions in the log myapplog -s abcde # will display the complete log for session 'abcde'
The following options are supported by pye. Options marked "Backend-specific" are not strictly required by pye, but may be required by the backend used. You need to refer to the documentation of the specific backend to learn more about the options.
Different backends may support more options than the basic ones described here. pye passes any option it doesn't recognize to the backend, but these options must be provided in full form, e.g. --find_master 1 or --find_master=1. Refer to your backend of choice for more information.
--find_master 1
--find_master=1
Required.
The Pye backend to use. For example, MongoDB for Pye::MongoDB.
Pye
MongoDB
Backend-specific.
The database system to use, only for backends that support different database systems. Pye::SQL, for example, supports MySQL, PostgreSQL and SQLite.
The database host.
The database port.
The name of the database. Defaults to "logs".
The name of the table or collection where log messages are stored. Defaults to "logs". -c and --collection are aliases for --table, the option sent to the backend will be called table.
-c
--collection
--table
table
Optional.
The session ID to display or log a message for.
The message to log to the database (requires session ID to be supplied too).
A JSON string to attach to the message.
The username to connect to the database with.
The password to connect to the database with.
Please report any bugs or feature requests to bug-Pye@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Pye.
bug-Pye@rt.cpan.org
You can find documentation for this module by invoking it with the -h switch:
-h
pye -h
Ido Perlmuter <ido@ido50.net>
Copyright (c) 2013-2015, Ido Perlmuter ido@ido50.net.
ido@ido50.net
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either version 5.8.1 or any later version. See perlartistic and perlgpl.
The full text of the license can be found in the LICENSE file included with this module.
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
To install Pye, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pye
CPAN shell
perl -MCPAN -e shell install Pye
For more information on module installation, please visit the detailed CPAN module installation guide.