Skip to content

Commit 7194510

Browse files
committed
updated readme
1 parent f59d44e commit 7194510

File tree

2 files changed

+101
-5
lines changed

2 files changed

+101
-5
lines changed

README.md

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,97 @@
1-
# winevt_tailer
2-
Windows Event Log Tailer. Reference implementation of [Mezmo Agent](https://github.com/logdna/logdna-agent-v2) Tailer API.
1+
# winevt-tailer
2+
Windows Event Log Tailer allows to live tail Windows events to standard output when running as console application or to log file when running as a service. It is written in Python, and is MIT licensed open source.
3+
4+
## Features
5+
- Live tail - following new events
6+
- Lookback
7+
- XPath queries
8+
- Keeping track of tailed events - presistent state
9+
- Windows service mode with self install / uninstall
10+
- Allows to add custom event transforms
11+
- Custom tail output using standard logging framework
12+
- Interation with Mezmo Agent
13+
14+
## Intallation
15+
Tailer is distributed as standalone executable.
16+
17+
## Getting Started
18+
19+
### Console mode (CLI)
20+
21+
To tail last 100 events from Application and last 100 events from System event logs (channels):
22+
23+
```
24+
winevt-tailer
25+
```
26+
27+
Tailer will output each event log message to stdout as single-line-JSON. Multi-line values are escaped with '\n'.
28+
29+
To tail last 10 events and to follow new events:
30+
31+
```
32+
winevt-tailer -f -b 10
33+
```
34+
35+
36+
### Service mode
37+
To install Tailer as Windows service:
38+
39+
```winevt-tailer -i```
40+
41+
or
42+
43+
```winevt-tailer -i <CLI args>```
44+
45+
- default service name: ```winevt-tailer_<tailer_name>```. default tailer name: ```tail1```, controlled by "-n" CLI arg
46+
47+
48+
Functionally this service will be equivalent to CLI mode: ```winevt-tailer <CLI args>```. To change CLI args - just call the same "-i" command again with different set of CLI args.
49+
50+
In service mode logs go to ```c:/ProgramData/logs```:
51+
52+
```
53+
windows_tail1.log -- Windows events in one-line-JSON format, ready to be streamed by Mezmo Agent
54+
winevt-tailer_tail1.log -- service instance log
55+
```
56+
57+
To uninstall the service:
58+
59+
```winevt-tailer -u```
60+
61+
## Advanced Usage
62+
63+
```
64+
> winevt-tailer.exe -h
65+
66+
usage: winevt-tailer.exe [-v | -h | -l | -e | -i | -u | -r] [-f] [-p] [-c filepath] [-n NAME] [-b LOOKBACK] [--tailer_config TAILER_CONFIG] [--logging_config LOGGING_CONFIG] [-s]
67+
68+
Tail Windows Event logs using single-line JSON format
69+
70+
options:
71+
-v, --version Show program version info and exit.
72+
-h, --help Show this help message and exit.
73+
-l, --list List event channel names accessible to current user. Some channels may need Admin rights.
74+
-e, --print_config Print effective config end exit.
75+
-i, --install_service
76+
Install windows service.
77+
-u, --uninstall_service
78+
Uninstall windows service.
79+
-r, --reset Reset persistent state - delete event bookmarks.
80+
-f, --follow Follow and output new events as they arrive. True in service mode.
81+
-p, --persistent Remember last tailed event for each channel and tail only new events after restart. Default: off
82+
-c filepath, --config filepath
83+
Config file path, file format: YAML
84+
-n NAME, --name NAME Tailer name. Also defines where to look for config: winevt-tailer/<name> in YAML file; TAILER_CONFIG_<name> and TAILER_LOGGING_<name> in env vars (as YAML string)
85+
-b LOOKBACK, --lookback LOOKBACK
86+
Defines how many old events to tail. -1 means all available events. default is 100. Applicable only to channels without persisted state
87+
--tailer_config TAILER_CONFIG
88+
Named tailer config section as YAML string
89+
--logging_config LOGGING_CONFIG
90+
Logging config section as YAML string
91+
-s, --startup_hello Output Startup Hello line. Part of Mezmo Agent Tailer API. Default: off
92+
```
93+
94+
95+
## Integration with Mezmo Agent
96+
97+
Tailer can be used with [Mezmo Agent](https://github.com/logdna/logdna-agent-v2) to stream log files to [Mezmo.com](https://www.mezmo.com).

winevt_tailer/opts.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ def parse_cmd_args(argv=None):
3434
Returns:
3535
dict: parsed arguments as argparse dict
3636
"""
37-
parser = argparse.ArgumentParser(description='Tails Windows Event logs to stdout in JSON format', add_help=False)
37+
parser = argparse.ArgumentParser(description='Tail Windows Event logs using single-line JSON format', add_help=False)
3838
group = parser.add_mutually_exclusive_group()
3939
group.add_argument('-v', '--version', action='version',
4040
version=f'{consts.TAILER_TYPE} {__version__}', help="Show program version info and exit.")
4141
group.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS,
4242
help='Show this help message and exit.')
4343
group.add_argument('-l', '--list', action='store_true', help='List event channel names accessible to current '
4444
'user. Some channels may need Admin rights.')
45-
group.add_argument('-e', '--print_config', action='store_true', help='Print effective config end exit.')
45+
group.add_argument('-e', '--print_config', action='store_true', help='Print effective config and exit.')
4646
group.add_argument('-i', '--install_service', action='store_true', help='Install windows service.')
4747
group.add_argument('-u', '--uninstall_service', action='store_true', help='Uninstall windows service.')
4848
group.add_argument('-r', '--reset', action='store_true', help='Reset persistent state - delete event bookmarks.')
@@ -59,7 +59,8 @@ def parse_cmd_args(argv=None):
5959
type=lambda val: str_regex_type(val, regex_str=r'^[^\s]+$'), default=consts.DEFAULT_TAILER_NAME)
6060
parser.add_argument('-b', '--lookback', type=int, help='Defines how many old events to tail. -1 means all '
6161
f'available events. default is {consts.DEFAULT_LOOKBACK}. '
62-
'Applicable only to channels without persisted state')
62+
'Applied in non-persistent mode or when event channel '
63+
'persistent state was not stored.')
6364
parser.add_argument('--tailer_config', help='Named tailer config section as YAML string', type=yaml_regex_type)
6465
parser.add_argument('--logging_config', help='Logging config section as YAML string', type=yaml_regex_type)
6566
parser.add_argument('-s', '--startup_hello', action='store_true',

0 commit comments

Comments
 (0)