|
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). |
0 commit comments