### Example Log File 2 Content Source: https://github.com/ptmcg/logmerger/blob/main/README.md Content of the second log file used in the example. ```log # log2.txt 2023-07-14 08:00:01 INFO Request processed successfully 2023-07-14 08:00:03 INFO User authentication succeeded 2023-07-14 08:00:06 DEBUG Starting data synchronization 2023-07-14 08:00:08 INFO Processing incoming request 2023-07-14 08:00:11 DEBUG Performing database backup 2023-07-14 08:00:14 WARN Invalid input received: missing required field ``` -------------------------------- ### Install logmerger Source: https://github.com/ptmcg/logmerger/blob/main/README.md Install the base logmerger package from PyPI. This makes it available as a console command. ```bash pip install logmerger ``` -------------------------------- ### Example Log File 1 Content Source: https://github.com/ptmcg/logmerger/blob/main/README.md Content of the first log file used in the example. ```log # log1.txt 2023-07-14 08:00:01 WARN Connection lost due to timeout 2023-07-14 08:00:04 ERROR Request processed unsuccessfully Something went wrong Traceback (last line is latest): sample.py: line 32 divide(100, 0) sample.py: line 8 return a / b ZeroDivisionError: division by zero 2023-07-14 08:00:06 INFO User authentication failed 2023-07-14 08:00:08 DEBUG Starting data synchronization 2023-07-14 08:00:11 INFO Processing incoming request ``` -------------------------------- ### Merged Log Output Example Source: https://github.com/ptmcg/logmerger/blob/main/README.md Example of the merged log output when sent to stdout. It shows timestamps and content from both log files. ```text Timestamp Files/Log1.Txt Files/Log2.Txt ──────────────────────────────────────────────────────────────────────────────────────────────────── 2023-07-14 08:00:01.000 WARN Connection lost due to INFO Request processed timeout successfully 2023-07-14 08:00:03.000 INFO User authentication succeeded 2023-07-14 08:00:04.000 ERROR Request processed unsuccessfully Something went wrong Traceback (last line is latest): sample.py: line 32 divide(100, 0) sample.py: line 8 return a / b ZeroDivisionError: division by zero 2023-07-14 08:00:06.000 INFO User authentication DEBUG Starting data failed synchronization 2023-07-14 08:00:08.000 DEBUG Starting data INFO Processing incoming request synchronization 2023-07-14 08:00:11.000 INFO Processing incoming request DEBUG Performing database backup INFO Processing incoming request (a little more...) 2023-07-14 08:00:14.000 DEBUG Performing database backup WARN Invalid input received: missing required field ``` -------------------------------- ### Install logmerger with pcap support Source: https://github.com/ptmcg/logmerger/blob/main/README.md Install logmerger with the extra 'pcap' dependency to enable merging of pcap files. ```bash pip install logmerger[pcap] ``` -------------------------------- ### Logmerger Command Line Help Source: https://github.com/ptmcg/logmerger/blob/main/README.md Display the help message for the logmerger command, showing all available arguments and their descriptions. ```bash usage: logmerger [-h] [--interactive] [--inline] [--output OUTPUT] [--start START] [--end END] [--autoclip] [--ignore_non_timestamped] [--width WIDTH] [--line_numbers] [--show_clock] [--csv CSV] [--encoding ENCODING] [--timestamp_format [TIMESTAMP_FORMATS ...]] [--demo] [files ...] positional arguments: files log files to be merged options: -h, --help show this help message and exit --interactive, -i show merged output using interactive TUI browser (default) --inline show merged log data as inline merge --output OUTPUT, -o OUTPUT save merged output to file ('-' for stdout; files ending in '.md' are saved using Markdown) --start START, -s START start time to select time window for merging logs --end END, -e END end time to select time window for merging logs --autoclip, -ac clip merging to time range of logs in first log file --ignore_non_timestamped ignore log lines that do not have a timestamp --width WIDTH, -w WIDTH total screen width to use for interactive mode (defaults to current screen width) --line_numbers, -ln add line number column --show_clock, -clock show running clock in header --csv CSV, -csv CSV save merged logs to CSV file --encoding ENCODING, -enc ENCODING encoding to use when reading log files (defaults to the system default encoding) --timestamp_format [TIMESTAMP_FORMATS ...] custom timestamp format --demo Run interactive demo ``` -------------------------------- ### Output Merged Logs to Stdout Source: https://github.com/ptmcg/logmerger/blob/main/README.md Use the --output - flag to send the merged logs to standard output instead of displaying the TUI. This is useful for piping the output to other commands or for saving to a file. ```bash logmerger --output - log1.txt log2.txt ``` -------------------------------- ### Merge Log Files with Logmerger Source: https://github.com/ptmcg/logmerger/blob/main/README.md Basic command to merge two log files using logmerger. This will display an interactive TUI. ```bash logmerger log1.txt log2.txt ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.