ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Nginx Log Highlighter

by jakebathman ST3

A Sublime Text 3 package that adds support for NGINX log syntax highlighting

Details

Installs

  • Total 5K
  • Win 2K
  • Mac 2K
  • Linux 1K
Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16
Windows 0 0 0 0 1 2 2 1 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 1 1 2 0 1 1
Mac 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 2 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1
Linux 0 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0
01234Apr 2Mar 30Mar 27Mar 24Mar 21Mar 18Mar 15Mar 12Mar 9Mar 6Mar 3Feb 28Feb 25Feb 22Feb 19Feb 16Apr 2 Linux: 0 Mac: 0 Windows: 0Apr 1 Linux: 2 Mac: 0 Windows: 0Mar 31 Linux: 0 Mac: 0 Windows: 0Mar 30 Linux: 1 Mac: 0 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 1Mar 28 Linux: 0 Mac: 0 Windows: 2Mar 27 Linux: 0 Mac: 1 Windows: 2Mar 26 Linux: 0 Mac: 0 Windows: 1Mar 25 Linux: 0 Mac: 0 Windows: 1Mar 24 Linux: 0 Mac: 0 Windows: 1Mar 23 Linux: 0 Mac: 0 Windows: 1Mar 22 Linux: 0 Mac: 0 Windows: 0Mar 21 Linux: 0 Mac: 0 Windows: 0Mar 20 Linux: 0 Mac: 0 Windows: 0Mar 19 Linux: 0 Mac: 1 Windows: 0Mar 18 Linux: 0 Mac: 1 Windows: 1Mar 17 Linux: 0 Mac: 1 Windows: 1Mar 16 Linux: 2 Mac: 2 Windows: 0Mar 15 Linux: 0 Mac: 0 Windows: 0Mar 14 Linux: 0 Mac: 0 Windows: 0Mar 13 Linux: 1 Mac: 0 Windows: 0Mar 12 Linux: 0 Mac: 0 Windows: 0Mar 11 Linux: 1 Mac: 1 Windows: 0Mar 10 Linux: 0 Mac: 0 Windows: 0Mar 9 Linux: 0 Mac: 0 Windows: 1Mar 8 Linux: 0 Mac: 0 Windows: 0Mar 7 Linux: 0 Mac: 0 Windows: 0Mar 6 Linux: 0 Mac: 0 Windows: 1Mar 5 Linux: 0 Mac: 1 Windows: 1Mar 4 Linux: 1 Mac: 0 Windows: 0Mar 3 Linux: 0 Mac: 0 Windows: 0Mar 2 Linux: 0 Mac: 0 Windows: 0Mar 1 Linux: 1 Mac: 0 Windows: 0Feb 28 Linux: 0 Mac: 0 Windows: 0Feb 27 Linux: 0 Mac: 0 Windows: 1Feb 26 Linux: 0 Mac: 1 Windows: 1Feb 25 Linux: 1 Mac: 0 Windows: 1Feb 24 Linux: 0 Mac: 0 Windows: 0Feb 23 Linux: 0 Mac: 0 Windows: 0Feb 22 Linux: 0 Mac: 0 Windows: 0Feb 21 Linux: 1 Mac: 0 Windows: 1Feb 20 Linux: 0 Mac: 0 Windows: 1Feb 19 Linux: 0 Mac: 0 Windows: 2Feb 18 Linux: 1 Mac: 0 Windows: 0Feb 17 Linux: 0 Mac: 1 Windows: 1Feb 16 Linux: 0 Mac: 1 Windows: 1Apr 2 Linux: 0 Mac: 0 Windows: 0Apr 1 Linux: 2 Mac: 0 Windows: 0Mar 31 Linux: 0 Mac: 0 Windows: 0Mar 30 Linux: 1 Mac: 0 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 1Mar 28 Linux: 0 Mac: 0 Windows: 2Mar 27 Linux: 0 Mac: 1 Windows: 2Mar 26 Linux: 0 Mac: 0 Windows: 1Mar 25 Linux: 0 Mac: 0 Windows: 1Mar 24 Linux: 0 Mac: 0 Windows: 1Mar 23 Linux: 0 Mac: 0 Windows: 1Mar 22 Linux: 0 Mac: 0 Windows: 0Mar 21 Linux: 0 Mac: 0 Windows: 0Mar 20 Linux: 0 Mac: 0 Windows: 0Mar 19 Linux: 0 Mac: 1 Windows: 0Mar 18 Linux: 0 Mac: 1 Windows: 1Mar 17 Linux: 0 Mac: 1 Windows: 1Mar 16 Linux: 2 Mac: 2 Windows: 0Mar 15 Linux: 0 Mac: 0 Windows: 0Mar 14 Linux: 0 Mac: 0 Windows: 0Mar 13 Linux: 1 Mac: 0 Windows: 0Mar 12 Linux: 0 Mac: 0 Windows: 0Mar 11 Linux: 1 Mac: 1 Windows: 0Mar 10 Linux: 0 Mac: 0 Windows: 0Mar 9 Linux: 0 Mac: 0 Windows: 1Mar 8 Linux: 0 Mac: 0 Windows: 0Mar 7 Linux: 0 Mac: 0 Windows: 0Mar 6 Linux: 0 Mac: 0 Windows: 1Mar 5 Linux: 0 Mac: 1 Windows: 1Mar 4 Linux: 1 Mac: 0 Windows: 0Mar 3 Linux: 0 Mac: 0 Windows: 0Mar 2 Linux: 0 Mac: 0 Windows: 0Mar 1 Linux: 1 Mac: 0 Windows: 0Feb 28 Linux: 0 Mac: 0 Windows: 0Feb 27 Linux: 0 Mac: 0 Windows: 1Feb 26 Linux: 0 Mac: 1 Windows: 1Feb 25 Linux: 1 Mac: 0 Windows: 1Feb 24 Linux: 0 Mac: 0 Windows: 0Feb 23 Linux: 0 Mac: 0 Windows: 0Feb 22 Linux: 0 Mac: 0 Windows: 0Feb 21 Linux: 1 Mac: 0 Windows: 1Feb 20 Linux: 0 Mac: 0 Windows: 1Feb 19 Linux: 0 Mac: 0 Windows: 2Feb 18 Linux: 1 Mac: 0 Windows: 0Feb 17 Linux: 0 Mac: 1 Windows: 1Feb 16 Linux: 0 Mac: 1 Windows: 1Apr 2 Linux: 0 Mac: 0 Windows: 0Apr 1 Linux: 2 Mac: 0 Windows: 0Mar 31 Linux: 0 Mac: 0 Windows: 0Mar 30 Linux: 1 Mac: 0 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 1Mar 28 Linux: 0 Mac: 0 Windows: 2Mar 27 Linux: 0 Mac: 1 Windows: 2Mar 26 Linux: 0 Mac: 0 Windows: 1Mar 25 Linux: 0 Mac: 0 Windows: 1Mar 24 Linux: 0 Mac: 0 Windows: 1Mar 23 Linux: 0 Mac: 0 Windows: 1Mar 22 Linux: 0 Mac: 0 Windows: 0Mar 21 Linux: 0 Mac: 0 Windows: 0Mar 20 Linux: 0 Mac: 0 Windows: 0Mar 19 Linux: 0 Mac: 1 Windows: 0Mar 18 Linux: 0 Mac: 1 Windows: 1Mar 17 Linux: 0 Mac: 1 Windows: 1Mar 16 Linux: 2 Mac: 2 Windows: 0Mar 15 Linux: 0 Mac: 0 Windows: 0Mar 14 Linux: 0 Mac: 0 Windows: 0Mar 13 Linux: 1 Mac: 0 Windows: 0Mar 12 Linux: 0 Mac: 0 Windows: 0Mar 11 Linux: 1 Mac: 1 Windows: 0Mar 10 Linux: 0 Mac: 0 Windows: 0Mar 9 Linux: 0 Mac: 0 Windows: 1Mar 8 Linux: 0 Mac: 0 Windows: 0Mar 7 Linux: 0 Mac: 0 Windows: 0Mar 6 Linux: 0 Mac: 0 Windows: 1Mar 5 Linux: 0 Mac: 1 Windows: 1Mar 4 Linux: 1 Mac: 0 Windows: 0Mar 3 Linux: 0 Mac: 0 Windows: 0Mar 2 Linux: 0 Mac: 0 Windows: 0Mar 1 Linux: 1 Mac: 0 Windows: 0Feb 28 Linux: 0 Mac: 0 Windows: 0Feb 27 Linux: 0 Mac: 0 Windows: 1Feb 26 Linux: 0 Mac: 1 Windows: 1Feb 25 Linux: 1 Mac: 0 Windows: 1Feb 24 Linux: 0 Mac: 0 Windows: 0Feb 23 Linux: 0 Mac: 0 Windows: 0Feb 22 Linux: 0 Mac: 0 Windows: 0Feb 21 Linux: 1 Mac: 0 Windows: 1Feb 20 Linux: 0 Mac: 0 Windows: 1Feb 19 Linux: 0 Mac: 0 Windows: 2Feb 18 Linux: 1 Mac: 0 Windows: 0Feb 17 Linux: 0 Mac: 1 Windows: 1Feb 16 Linux: 0 Mac: 1 Windows: 1

Readme

Source
raw.​githubusercontent.​com

Nginx Log Highlighting

A Sublime Text 3 package that adds support for NGINX access log syntax highlighting.

The expected format is:

remote_addr - remote_user [time_local]request_verb request_endpoint request_resultstatus body_bytes_senthttp_referer” “http_user_agent” “http_x_forwarded_for

Where the three http* elements after body_bytes_sent are optional.

How do I use this?

  1. Open an access.log file in Sublime, or paste a few log lines in an empty tab.
  2. In the Command Palette, select Set Syntax: Nginx Log. You can also change the syntax in the lower-right menu.
  3. That's it! If you want to change some colors, see below.

Example

Here's an example NGINX log output line, which can also be used to test your color scheme:

192.168.42.24 - - [31/Oct/2017:20:19:18 +0000] "GET /foo/request/index.php?bar=baz HTTP/1.1" 200 33441 "http://example.com/referer" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36" "-"

Default colors

Using a default scheme, you'll see some color variation, e.g.:

IDLE

screenshot_lite

Solarized-dark

screenshot_dark

Custom colors

The syntax of a log line is parsed into multiple scopes. Using the example line above, here are the assigned scopes (all prefixed with text.nginx meta.nginx.log):

Built-In Scope Custom Scope Log piece
keyword remote_addr 192.168.42.24
comment spacer -
text remote_user -
string time_local [31/Oct/2017:20:19:18 +0000]
constant request_type GET
support.function request /foo/request/index.php?bar=baz
keyword.operator request_result HTTP/1.1
keyword.other status 200
entity.other.attribute-name body_bytes_sent 33441
entity.name.tag http_referer http://example.com/referer
constant.numeric http_user_agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36
string http_x_forwarded_for -

The built-in scopes don't necessarily correspond to the log piece type; they're simply different scopes that most robust themes include a different color for, and will help make your log statements stand out without adding custom theme definitions.

If you do want to style each piece yourself, add a style definition for each scope to your .tmTheme file, like this:

<dict>
        <key>name</key>
        <string>remote_addr</string>
        <key>scope</key>
        <string>text.nginx meta.nginx.log remote_addr</string>
        <key>settings</key>
        <dict>
            <key>foreground</key>
            <string>#FF4D4D</string>
        </dict>
    </dict>

TO-DO

  • [ ] Add support for other log formats (or a custom format)
  • [x] Add theme file and/or example color scheme definitions