### Install Nerdlog with Go install Source: https://github.com/dimonomid/nerdlog/blob/master/README.md Installs the Nerdlog binary using the `go install` command. This method allows installing the latest release or the latest master branch. ```go go install github.com/dimonomid/nerdlog/cmd/nerdlog@latest ``` ```go go install github.com/dimonomid/nerdlog/cmd/nerdlog@master ``` -------------------------------- ### Install Nerdlog with Make Source: https://github.com/dimonomid/nerdlog/blob/master/README.md Installs the Nerdlog binary to /usr/local/bin using the `make` command. Alternatively, it can be built and run directly without installation. ```bash make && sudo make install ``` ```bash make && bin/nerdlog ``` -------------------------------- ### Install X11 Dev Package on Ubuntu Source: https://github.com/dimonomid/nerdlog/blob/master/README.md Installs the necessary X11 development package on Ubuntu systems, required for clipboard access by Nerdlog's underlying library. ```bash sudo apt install libx11-dev ``` -------------------------------- ### Apache Log Entry Example Source: https://github.com/dimonomid/nerdlog/blob/master/core/core_testdata/test_cases_core/04_apache/want_log_resp_01_initial.txt Example of a single Apache log entry, including timestamp, severity, file path, and the log message itself. This format is typical for web server logs. ```text 2025-06-03T13:45:27.123456000Z,F,/tmp/nerdlog_core_test_output/04_apache/lstreams/testhost-3/logfile,000001,000001,----,[core:notice] [pid 1234] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' ``` -------------------------------- ### Nerdlog Configuration File (logstreams.yaml) Source: https://github.com/dimonomid/nerdlog/blob/master/README.md Example of the nerdlog configuration file for defining custom logstreams, including hostname, port, user, and specific log files. ```yaml log_streams: myhost-01: hostname: actualhost1.com port: 1234 user: myuser log_files: - /some/custom/logfile myhost-02: hostname: actualhost2.com port: 7890 user: myuser log_files: - /some/custom/logfile ``` -------------------------------- ### Manage Options Source: https://github.com/dimonomid/nerdlog/blob/master/README.md Allows users to get the current value of an option or set an option to a new value. A full list of supported options is available via a separate link. ```shell :set option? ``` ```shell :set option=value ``` -------------------------------- ### Nerdlog Awk Pattern Input Examples Source: https://github.com/dimonomid/nerdlog/blob/master/README.md Provides examples of valid Awk patterns that can be used to filter logs in Nerdlog. These patterns support simple regular expressions and more complex conditional logic. ```Nerdlog Syntax Simple regexp: `/foo bar/` ``` ```Nerdlog Syntax Regexps with complex conditions: `( /foo bar/ || /other stuff/ ) && !/baz/` ``` -------------------------------- ### Nerdlog Field Selection Syntax Source: https://github.com/dimonomid/nerdlog/blob/master/cmd/nerdlog/e2e_testdata/test_scenarios/01_basic/want_screen_05_after_restart.txt Illustrates the syntax for selecting specific fields from log entries. Allows aliasing fields using 'AS' and selecting all remaining fields with '*'. ```text Select field expression. Example: "time STICKY, message, lstream, level_name AS level, *" time STICKY, lstream, message, * ``` -------------------------------- ### Awk Pattern Examples for Log Filtering Source: https://github.com/dimonomid/nerdlog/blob/master/cmd/nerdlog/e2e_testdata/test_scenarios/01_basic/want_screen_01_initial.txt Provides examples of awk patterns used for filtering log entries. These patterns can include simple string matches, regular expressions, and logical combinations of conditions. ```awk /foo bar/ ``` ```awk ( /foo bar/ || /other stuff/ ) && !/baz/ ``` -------------------------------- ### Awk Pattern Matching Example Source: https://github.com/dimonomid/nerdlog/blob/master/docs/faq.md Demonstrates the use of Awk's pattern matching capabilities, including combining patterns with boolean operators for complex filtering. This highlights the flexibility and readability of Awk for log processing. ```awk /foo/ && !/bar/ && (/this/ || /that/) ``` -------------------------------- ### Apache SSL Warning Log Entry Source: https://github.com/dimonomid/nerdlog/blob/master/core/core_testdata/test_cases_core/04_apache/want_log_resp_01_initial.txt Example of an Apache log entry related to SSL warnings, specifically concerning RSA server certificates. This is useful for diagnosing TLS/SSL configuration issues. ```text 2025-06-03T13:50:00.000123000Z,F,/tmp/nerdlog_core_test_output/04_apache/lstreams/testhost-3/logfile,000005,000005,warn,[ssl:warn] [pid 1234] AH01906: RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?) ``` -------------------------------- ### SSH Config Example for Host Aliases Source: https://github.com/dimonomid/nerdlog/blob/master/docs/core_concepts.md Illustrates how entries in the `~/.ssh/config` file can be used to define aliases for hosts, including user, hostname, and port. This simplifies connection details. ```text Host myhost-01 User myuser HostName actualhost1.com Port 1234 Host myhost-02 User myuser HostName actualhost2.com Port 7890 ``` -------------------------------- ### Filtering Logs with Bash Command Source: https://github.com/dimonomid/nerdlog/blob/master/core/core_testdata/test_cases_core/03_may_jun/want_log_resp_01_initial.txt This snippet demonstrates a bash command used to filter log files based on a specified time range. It utilizes 'tail' to get data from a starting offset and 'head' to limit the output by size. The command is designed to extract relevant log entries from a file. ```bash bash -c 'tail -c +8680 /tmp/nerdlog_core_test_output/03_may_jun/lstreams/testhost-3/logfile.1 | head -c 1054' ``` -------------------------------- ### Specify Multiple Log Files in Nerdlog Source: https://github.com/dimonomid/nerdlog/blob/master/docs/limitations.md This example shows how to specify multiple log files for Nerdlog to read from a server, including a previous log file. ```nerdlog myserver.com:22:/var/log/syslog.1:/var/log/syslog.2 ``` -------------------------------- ### Nerdlog Logstream Specification Source: https://github.com/dimonomid/nerdlog/blob/master/cmd/nerdlog/e2e_testdata/test_scenarios/01_basic/want_screen_05_after_restart.txt Explains how to specify logstreams, which are comma-separated strings identifying log sources. The format includes optional user, hostname, port, and log file path. ```text Logstreams. Comma-separated strings in the format "[user@]myserver.com[:port[:/path/to/logfile]]" Examples: "user@myserver.com", or "user@myserver.com:22:/var/log/syslog" testhost-01 ``` -------------------------------- ### Apache PHP Error Log Entry Source: https://github.com/dimonomid/nerdlog/blob/master/core/core_testdata/test_cases_core/04_apache/want_log_resp_01_initial.txt An example of an Apache log entry indicating a PHP Fatal error. This highlights errors originating from the PHP interpreter within the web server. ```text 2025-06-03T13:48:45.543210000Z,F,/tmp/nerdlog_core_test_output/04_apache/lstreams/testhost-3/logfile,000004,000004,erro,[php:error] [pid 1278] [client 192.168.1.101:49802] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/www/html/index.php:12 ``` -------------------------------- ### Nerdlog Awk Pattern Filtering Source: https://github.com/dimonomid/nerdlog/blob/master/cmd/nerdlog/e2e_testdata/test_scenarios/01_basic/want_screen_05_after_restart.txt Details the use of awk patterns for filtering log entries. Supports regular expressions and logical operators like AND, OR, and NOT. ```text awk pattern. Examples: "/foo bar/", or "( /foo bar/ || /other stuff/ ) && !/baz/" /warn/ ``` -------------------------------- ### Nerdlog Logstream Identification Source: https://github.com/dimonomid/nerdlog/blob/master/cmd/nerdlog/e2e_testdata/test_scenarios/03_cli_flag_set_numlines/want_screen_01_initial.txt Specifies the format for identifying log streams. Logstreams are comma-separated strings representing servers and log file paths. Examples include 'user@myserver.com' or 'user@myserver.com:22:/var/log/syslog'. ```Nerdlog Query Syntax Logstreams. Comma-separated strings in the format "[user@]myserver.com[:port[:/path/to/logfile]]" Examples: "user@myserver.com", or "user@myserver.com:22:/var/log/syslog" localhost ``` -------------------------------- ### Filtering Logs with Bash Source: https://github.com/dimonomid/nerdlog/blob/master/core/core_testdata/test_cases_core/01_simple/want_log_resp_03_load_more.txt Demonstrates using the 'tail' command in bash to filter log entries starting from a specific byte offset. This is useful for incremental log processing or resuming from a previous point. ```bash debug: bash -c 'tail -c +49400 /tmp/nerdlog_core_test_output/01_simple/lstreams/testhost-1/logfile' ``` -------------------------------- ### Nerdlog custom transport command with SSH Source: https://github.com/dimonomid/nerdlog/blob/master/docs/options.md Provides an example of a custom transport command for Nerdlog that replicates the functionality of the 'ssh-bin' transport. It utilizes Nerdlog-specific variables like NLHOST, NLPORT, and NLUSER, along with standard shell variable expansions, to construct the SSH command. ```shell custom:ssh -o 'BatchMode=yes' ${NLPORT:+-p ${NLPORT}} ${NLUSER:+${NLUSER}@}${NLHOST} /bin/sh ``` -------------------------------- ### Nerdlog Time Range Syntax Source: https://github.com/dimonomid/nerdlog/blob/master/cmd/nerdlog/e2e_testdata/test_scenarios/01_basic/want_screen_05_after_restart.txt Defines the format for specifying time ranges in queries. Supports absolute times (e.g., 'Mar27 12:00') and relative times (e.g., '-2h30m'). The 'to' part is optional, defaulting to the current time. ```text Time range in the format "