File: xwatch.tex

package info (click to toggle)
xwatch 2.11-12
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 396 kB
  • ctags: 77
  • sloc: ansic: 864; makefile: 114
file content (313 lines) | stat: -rw-r--r-- 14,508 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313



\documentclass{report}
\usepackage[T1]{fontenc}
\hfuzz=4pt % don't fuss when less than 4pt
\input{/usr/share/yodl/xlatin1.tex}
\setlength{\parskip}{3mm} % height between par
\setlength{\parindent}{0mm} % no par indent

\title{XWatch \ \\  The Logfiles Watcher}
\author{Karel Kubat (karel@icce.rug.nl) \ \\  State University of Groningen \ \\  Westerhaven 16, 9718 AW Groningen \ \\  The Netherlands}
\date{1996}
\begin{document}
\maketitle

\clearpage\tableofcontents 
\clearpage

\chapter{Introduction} 

    \texttt{XWatch} is a small program that I wrote to monitor logfiles and to see
    any changes \textbf{directly} (instead of having to read all the logs after a
    breakin or a crash). \texttt{XWatch} is simply started with a few file
    arguments, and any information that appears on the files is displayed.
    With a slider you can see past information; i.e., lines that scroll in
    \texttt{xwatch}'s window. That's all there is to it. The appearance of the
    \texttt{xwatch} window can furthermore be modified via command line flags or
    via an application defaults file. (Older versions of \texttt{XWatch} had a
    button to activate an `options' window. I removed this code, almost no-one
    uses it.)

    \texttt{XWatch} is incidentally my first applications with the XForms GUI
    library for X, which I can highly recommend for developers who want to
    start `X programming' but who don't want to go through the hassle of
    having to learn about intrinsics. XForms is really excellent. Congrats,
    T.C. Zhao and Mark Overmars (the latter is rumored to bootleg at a soccer
    club in his free time ;). Instructions on where and how to get the XForms
    library are in the \texttt{Makefile}, contained in \texttt{xwatch}'s distribution.

\chapter{Using xwatch}

    You typically start \texttt{xwatch} when activating an X session; e.g.,
    from the file which xdm uses to fire up a user's session (this file is
    normally \texttt{/usr/X11/lib/X11/xdm/Xsession}). The command that starts
    \texttt{xwatch} is something like

\begin{verbatim} 
xwatch [options] files &
 
\end{verbatim} 
 

    where `options' are optional flags, files are the files to watch, and
    the ampersand character is used to start \texttt{xwatch} in the background. The
    files to watch are typically in the directory \texttt{/var/adm/}: files which
    are created by the syslog daemon (see the file \texttt{syslogd.conf.SAMPLE} in
    the distribution for an example).  \texttt{XWatch} accepts only filenames which
    are:

    \begin{itemize}

	\item  ordinary files, no sockets, directory names,

	\item  which are not binary files.
    
    \end{itemize} 

    Other files as stated on the commandline are not monitored. When any
    `non-proper' file is given on the commandline, \texttt{xwatch} warns about the
    file not being acceptable and deletes it from its list of names.

\section{Options to the xwatch program} 

    The options are many, start \texttt{xwatch} without arguments to see what is
    supported. All options can also be stated in the file
    \texttt{/usr/lib/X11/app-defaults/XWatch} as X resources (see the file
    \texttt{XWatch.ap} as an example). In the following enumeration, a \emph{nr}
    denotes a number:

    \begin{itemize}

	\item  \texttt{-border} \emph{nr}:  Specifies whether \texttt{xwatch} should start
        with a border. The \emph{nr} must be 0 or 1. When you start \texttt{xwatch}
        without a border, your window manager may not be able to resize or
        even recognize it. Incidentally, this may be what you want -- I use it
        to `hide' the presence of \texttt{xwatch} from my window manager \texttt{fvwm}. 
        
        \item  \texttt{-geometry} \emph{geom}: Specifies the display geometry, \'{a}-la 
        other X programs. You can express the geometry in terms of \emph{WxH} 
        (width by height), optionally postfixed by \emph{+X+Y} (x and y offset) 
        or \emph{-X-Y} (offsets relative to the lower right corner) and other 
        combinations. 
        
        Note that previous switches that emulated the geometry specification, 
        such as \texttt{-xpos} and \texttt{-height}, are now obsolete. Use the geometry 
        setting.
        
        \item  \texttt{-fg} \emph{color} and \texttt{-bg} \emph{color}: These options define the 
        default foreground and background of the watch window.
        
        Note that previous switches, such as \texttt{-bred} and \texttt{-bblue}, are now 
        obsolete. 

	\item  \texttt{-printtime} \emph{nr}: Defines whether \texttt{xwatch} should prefix
        any info on the watched files with a timestamp. The \texttt{nr} can be 0 or
        zero; the timestamp is printed when \emph{nr} is 1.

	\item  \texttt{-printname} \emph{nr}: Defines whether \texttt{xwatch} should prefix
        any info on the watched files with the filename. The \emph{nr} is again a
        flag, 0 or 1.

	\item  \texttt{-newline} \emph{nr}: Defines whether \texttt{xwatch} should let a
        newline follow the time and/or filename stamp, so that the actual
        information is displayed on its own line.

	\item  \texttt{-interval} \emph{nr}: Defines the scanning interval.  Each \emph{nr}
        seconds, \texttt{xwatch} will check if new information has arrived on the
        watched files. The \emph{nr} may be between 1 and 30 seconds. 

	\item  \texttt{-fontsize} \emph{nr}: Defines the initial size of the display
        font.  The \emph{nr} may range from 1 to 4; 1 being the smallest font and
        4 being the largest.

	\item  \texttt{-fontstyle} \emph{nr}: Defines the style of the used font. The
        \emph{nr} is a number between 0 and 15 (0 being the default). Start
        \texttt{xwatch} without arguments or read the application defaults file to
        see what fonts the numbers choose.

	\item  \texttt{-firstwarnings} \emph{nr}: Defines whether \texttt{xwatch} should
        print initial warnings into the watch window.  E.g., you might like to
        set \texttt{firstwarnings} to zero, and then start \texttt{xwatch} with the file
        argument \texttt{/var/adm/*}.  Warnings about, e.g., \texttt{utmp} being a
        binary file would then be suppressed.

	\item  \texttt{-printversion} \emph{nr}: Controls whether \texttt{xwatch} prints its
        version number and copyright notice upon startup in the watch window.

        \item  \texttt{-gag} \emph{text}: This option, when present, prevents all lines 
        with \emph{text} in them from being shown in the display window. You can 
        specify more than one string to `gag', in that case, separate the 
        strings with \texttt{\textbar }.
        
        \item  \texttt{-colorstring} \emph{col:string}: This option causes lines that 
        contain \texttt{string} to be displayed using the specified color.
        The string is matched literally. 
        E.g., if you use the option \texttt{-colorstring blue:connection} then 
        all lines containing \texttt{connection} are displayed in pure blue.
        
        You can specify several colorstrings by separating all options with a 
        \textbar  character, as in \texttt{-colorstring blue:connection\textbar red:error}. Note 
        that, for reasons of shell expansion, you should quote such options on 
        the commandline.
        
        \item  \texttt{-title} \emph{name}: This option sets the window title of the 
        watch window. Note that the title will only be visible when \texttt{border} 
        is not 0. This option may be useful if you have several XWatch 
        windows, monitoring different things.
        
        \item  \texttt{-ignore} \emph{fileA\textbar fileB\textbar fileC\textbar ...}: This option is handy if 
        you start XWatch with a wildcard file argument, but when you want 
        XWatch \textbf{not} to process some files. The \texttt{-ignore} flag removes 
        the stated files from the watchlist. Note that, for reasons of shell 
        commandline expansion, you must quote the file specification (or the 
        shell will interpret the \textbar  characters as pipes). (Thanks, Frank 
        Brokken, \texttt{frank@icce.rug.nl} for the code).

    \end{itemize}
    
    Before you extensively use the options, create an application defaults
    file \texttt{/usr/lib/X11/app-defaults/XWatch}. You can do so by copying the
    file \texttt{XWatch.ap}, extracted from the archive, to
    \texttt{/usr/lib/X11/app-defaults/XWatch}. The comments in the distributed 
    application defaults file explain what you can configure and show 
    examples. 

    Some systems do not have the directory \texttt{/usr/lib/X11/app-defaults}.  In
    that case, you should create the following links:

    \begin{itemize}

	\item  \texttt{/usr/X11} should point to your X11 distribution; e.g.  to
        \texttt{/usr/X11R6}. That way, you always have e.g.  \texttt{/usr/X11/bin}, even
        after upgrading your X11 distribution. All that is needed is one new
        link.

	\item  \texttt{/usr/lib/X11} should point to \texttt{/usr/X11/lib/X11}.

    \end{itemize}
    
    Then edit the file \texttt{XWatch} in the application defaults directory, and
    follow the instructions therein to define your favorite settings.  If you
    need to start \texttt{xwatch} incidentally with another setting, use a flag.

\section{File arguments}

    The filename arguments can optionally be followed by a color
    specification that applies only to that particular file. E.g., say you
    want to see all the files in \texttt{/var/adm} normally in blue text; but you
    want to see \texttt{/var/adm/critical} (critical messages from applications) in
    yellow and \texttt{/var/adm/auth} (authentification messages) in red. In that
    case, the course to follow would be:

    \begin{itemize}

	\item  The default foreground color would be blue. You could set this
        with the flags \texttt{-fg blue}, or in the application
        defaults file.

	\item  The color for \texttt{/var/adm/critical} should be yellow.  Hence, the
        first file argument would be \texttt{/var/adm/critical:yellow}.

	\item  The color for file \texttt{/var/adm/auth} should be red, hence the
        second file argument would be \texttt{/var/adm/auth:red}.

	\item  The following arguments would be the files, using the standard
        foreground (blue): \texttt{/var/adm/*}, without any extra color
        specifications.
    
    \end{itemize} 

    Such a commandline would cause \texttt{xwatch} to complain about the multiple
    presence of \texttt{/var/adm/critical} (once from the separate argument, and
    once from the wildcard argument) and similarly about \texttt{/var/adm/auth}. If
    this bothers you, turn off the initial warnings (e.g., using
    \texttt{-firstwarnings 0} or in the application defaults file).
    
    Note that besides the color specifications for filenames, you can 
    also specify coloring for lines that match a given string in all files. 
    See the above description of the  switch \texttt{-colorstring} for more 
    information.
    




\chapter{Obtaining xwatch} 

    \texttt{XWatch} can be obtained at the ftp site \texttt{ftp.icce.rug.nl}, in the directory \texttt{/pub/unix}, as the file \texttt{xwatch-X.YY.tar.gz}.
    \texttt{X.YY} is the version number, e.g., 1.00. This site is the primary site,
    so check here for new versions.

    To unpack the archive, change-dir to your `sources' directory (e.g.,
    \texttt{/usr/local/src}) and type

\begin{verbatim} 
tar xvzf /where/ever/you/put/it/xwatch-X.YY.tar.gz
 
\end{verbatim} 
 

    Next, change-dir to the unpacked subdirectory \texttt{xwatch} and check there.
    You will find a subdirectory \texttt{src} with the full sources.

\chapter{Compiling xwatch}



    Follow these steps.

    \begin{itemize}

	\item  You will need the XForms library and include files to compile
        \texttt{xwatch}.  Check the \texttt{Makefile} in the \texttt{src} subdirectory for
        two ftp sites that carry XForms for Linux. Obtain the library and
        install it.  XWatch will happily run with XForms version 0.81 or 0.88.

	\item  In the \texttt{src} subdirectory, edit the \texttt{Makefile} and adjust
        some defines at the top. E.g., a \texttt{make install} copies the binary by
        default to \texttt{/usr/local/X11/bin}; adjust that if you don't like this
        behavior.

	\item  Next, do a \texttt{make install}, followed by a \texttt{make clean}.
        
        \item  Copy the file \texttt{XWatch.ap} from the source directory to 
        \texttt{/usr/lib/X11/app-defaults/XWatch}. Edit the file and state your 
        favorite settings.
        
        \item  Next, start the program \texttt{xwatch} with some file arguments in 
        your logfiles directory. If you're satisfied with the appearance and 
        workings of \texttt{xwatch}, add the invocation to your script that starts
	an X session.

    \end{itemize}

\chapter{Copyright} 

    XWatch - a tool to monitor logfiles and display new logs in an X window.  
    Copyright (C) 1995 Karel Kubat.  All rights reserved.
    
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.
    
    You may link this software with XForms (Copyright (C) by T.C. Zhao and
    Mark Overmars) and distribute the resulting binary, under the
    restrictions in clause 3 of the GPL, even though the resulting binary is
    not, as a whole, covered by the GPL. (You still need a separate license
    to do so from the owner(s) of the copyright for XForms, however).  If a
    derivative no longer requires XForms, you may use the unsupplemented GPL
    as its license by deleting this paragraph and therefore removing this
    exemption for XForms.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
\end{document}