LogCast documentation

invocation

LogCast has very simple command line syntax. To start LogCast, simply issue the following command:

java -jar logcast.jar property_filename

Or, if if you have included logcast.jar in your CLASSPATH, you can invoke LogCast by directly invoking its main class.

java sharky.app.logcast.Main property_filename

You must have Java 1.2 (JRE or JDK) installed to run this program. (See the download page for more information.)

configuration

Regardless of how you launch LogCast, it requires only a single argument to get started: the name of a Java properties file containing the following keys:

property name meaning if omitted
bind_address Address to bind to if you are running a multi-host system. LogCast binds to all addresses.
bind_port Port to listen on. LogCast automatically selects a random port and echos its value to stderr.
max_connections Maximum number of simultaneous client connections allowed. Defaults to 1.
backlog Maximum number of client connection requests that can be queued after the maximum number of connections has been reached. Automatically set equal to max_connections.
buffer_size Number of lines a slow client connection can lag behind before lines are automatically skipped. Defaults to 100
access_rules Path to file containing access rules. Defaults to "access_rules".

A Java properties file is a simple text file containing a list of name=value pairs. Optional "hash comments" can also be included. A sample LogCast configuration file is shown below:

bind_address=127.0.0.1 # comment out to bind to all addresses:
bind_port=1234         # comment out to bind to random port
max_connections=2
backlog=10
buffer_size=50
access_rules=rules

access rules

The access rules is a very simple text file containing a series of allow and deny lines. Each allow or deny line contains the word "allow" or "deny" and is followed by an IP address mask. Wildcards are allowed in the masks. Here is an example:

# First, deny everyone:
deny *

# Then, make the following exceptions:

# Allow everyone on subnet 192.168:
allow 192.168.*

# But not Harry, because I don't like him:
deny 192.168.1.2

As shown in the example, hashed comments are allowed. When a client connects to a server, its IP address is determined and then subjected to each rule in the list. When several rules apply to the IP address being tested, the last rule takes priority. In other words, if the IP address is accepted by the last applicable rule, the connection is accepted. Otherwise, the connection is terminated without explanation.

All connections are denied by default (so the first line in the example above is somewhat redundant). If the file contains errors, no connections are accepted. The access rules file can be edited and rewritten while the LogCast server is running, because LogCast rescans the file every time a new client connection is initiated.

usage ideas

LogCast can be used to transmit and forward a directly connected text stream or it can be used to "tap into" an already existing text stream. Here are some examples:

Run a process and broadcast its stdout:

process process_arguments | java -jar logcast.jar logcast_settings_file

Tap into a log file that is growing from an already existing process:

tail -f apache_log_file | java -jar logcast.jar logcast_settings_file

After the LogCast server is running, you can connect to it with any standard telnet client:

telnet hostname logcastport

[ LogCast home ]

Copyright (c) 2000 Sharkysoft (sharkysoft.com). All rights reserved.