Repository: sharkdp/bat (language: rust)

Issue:
syslog highlighting confused if there is no colon in message
<!-- Hey there, thank you for creating an issue! -->

**Describe the bug you encountered:**

Syslog highlighter gets confused if a message without colon occurs. Highlighting "leaks" to the next line, gets likely terminated by the colon in the next line's timestamp, and works thereafter.

Example (on Ubuntu 20.04, rsyslog):
```shellsession
$ logger --server localhost hello
$ tail -n 1 /var/log/syslog
Aug 11 21:40:31 uncleman scop hello
```
![Screenshot from 2021-08-11 21-45-01](https://user-images.githubusercontent.com/109152/129085572-b106edc0-ae27-4a81-8639-84b86de50a1f.png)

**What did you expect to happen instead?**

No confusion, lines with messages without colons would work.


**How did you install `bat`?**

<!-- apt-get, homebrew, GitHub release, etc. -->

Current git master.

**bat version and environment**

<!--
In order to reproduce your issue, please add some information about the environment
in which you're running bat. To do this, run the full `bat` command that demonstrates
the bug, and attach the `--diagnostic` option:

    bat [other options and arguments…] --diagnostic

Finally, paste the Markdown output here. Please make sure that it does not reveal any
personal information.


If you are running bat 0.17.1 or older (where --diagnostic is not available), please
run the script at

    https://github.com/sharkdp/bat/blob/master/diagnostics/info.sh

(click "Raw" to get the actual source code) and paste the Markdown output here. If you
are on Windows, please let us know your bat version and your Windows version.
-->



Discussion / hints:
Thank you for reporting this.


It would be fantastic if @keith-hall could have a look into this (https://github.com/sharkdp/bat/pull/1606 for context)
I believe this has been addressed with https://github.com/sharkdp/bat/pull/1793 and thus this issue can be closed - please correct me if I'm wrong, @scop ? :)
Correcting :) #1793 addressed two different issues, this one's still open as reported.

Fix patch:
diff --git a/assets/syntaxes/02_Extra/syslog.sublime-syntax b/assets/syntaxes/02_Extra/syslog.sublime-syntax
index 8c4523a881..1efad34658 100644
--- a/assets/syntaxes/02_Extra/syslog.sublime-syntax
+++ b/assets/syntaxes/02_Extra/syslog.sublime-syntax
@@ -20,7 +20,7 @@ contexts:
       scope: entity.other.attribute-name.loghost.syslog
       set: process
   process:
-    - match: ([\w.-]+)(?:(\[)(\d+)(\]))?(:)
+    - match: ([\w.-]+)(?:(\[)(\d+)(\]))?([ :])
       captures:
         1: support.function.process.syslog
         2: punctuation.separator.pid.begin.syslog


Test patch:
diff --git a/tests/syntax-tests/highlighted/Syslog/example.syslog b/tests/syntax-tests/highlighted/Syslog/example.syslog
index 3c6c29edb4..9ec04944d3 100644
--- a/tests/syntax-tests/highlighted/Syslog/example.syslog
+++ b/tests/syntax-tests/highlighted/Syslog/example.syslog
@@ -12,3 +12,5 @@
 [38;2;190;132;255mAug 11[0m[38;2;190;132;255m [0m[38;2;190;132;255m13:29:06[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239minsomnia_insomnia.desktop[0m[38;2;248;248;242m[[0m[38;2;190;132;255m142666[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m13:29:06[0m[38;2;190;132;255m.[0m[38;2;190;132;255m316[0m[38;2;248;248;242m › [updater] Updater not running [0m[3;38;2;253;151;31mplatform[0m[38;2;249;38;114m=[0m[38;2;248;248;242mlinux [0m[3;38;2;253;151;31mdev[0m[38;2;249;38;114m=[0m[38;2;248;248;242mfalse[0m
 [38;2;190;132;255mAug 11[0m[38;2;190;132;255m [0m[38;2;190;132;255m13:36:34[0m[38;2;248;248;242m [0m[38;2;166;226;46m192.168.220.5[0m[38;2;248;248;242m [0m[38;2;102;217;239mnginx[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m2021/08/11[0m[38;2;248;248;242m [0m[38;2;190;132;255m13:36:34[0m[38;2;248;248;242m [debug] [0m[38;2;190;132;255m2031[0m[38;2;248;248;242m#[0m[38;2;190;132;255m2031[0m[38;2;248;248;242m: epoll add event: fd:[0m[38;2;190;132;255m6[0m[38;2;248;248;242m op:[0m[38;2;190;132;255m1[0m[38;2;248;248;242m ev:[0m[38;2;190;132;255m00002001[0m
 [38;2;190;132;255mAug 11[0m[38;2;190;132;255m [0m[38;2;190;132;255m21:31:08[0m[38;2;248;248;242m [0m[38;2;166;226;46m::1[0m[38;2;248;248;242m [0m[38;2;102;217;239mnginx[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m2021/08/11[0m[38;2;248;248;242m [0m[38;2;190;132;255m21:31:08[0m[38;2;248;248;242m [debug] [0m[38;2;190;132;255m760831[0m[38;2;248;248;242m#[0m[38;2;190;132;255m760831[0m[38;2;248;248;242m: epoll add event: fd:[0m[38;2;190;132;255m6[0m[38;2;248;248;242m op:[0m[38;2;190;132;255m1[0m[38;2;248;248;242m ev:[0m[38;2;190;132;255m10000001[0m
+[38;2;190;132;255mAug 11[0m[38;2;190;132;255m [0m[38;2;190;132;255m21:40:31[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mscop[0m[38;2;248;248;242m [0m[38;2;248;248;242mhello[0m
+[38;2;190;132;255mAug 16[0m[38;2;190;132;255m [0m[38;2;190;132;255m21:38:21[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239msystemd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m Finished Cleanup of Temporary Directories.[0m
diff --git a/tests/syntax-tests/source/Syslog/example.syslog b/tests/syntax-tests/source/Syslog/example.syslog
index 0cde74cdd1..9dc82e7c1a 100644
--- a/tests/syntax-tests/source/Syslog/example.syslog
+++ b/tests/syntax-tests/source/Syslog/example.syslog
@@ -12,3 +12,5 @@ Apr  4 22:00:45 hostname-here dbus-daemon[1094]: [session uid=1000 pid=1094] Suc
 Aug 11 13:29:06 hostname-here insomnia_insomnia.desktop[142666]: 13:29:06.316 › [updater] Updater not running platform=linux dev=false
 Aug 11 13:36:34 192.168.220.5 nginx: 2021/08/11 13:36:34 [debug] 2031#2031: epoll add event: fd:6 op:1 ev:00002001
 Aug 11 21:31:08 ::1 nginx: 2021/08/11 21:31:08 [debug] 760831#760831: epoll add event: fd:6 op:1 ev:10000001
+Aug 11 21:40:31 hostname-here scop hello
+Aug 16 21:38:21 hostname-here systemd[1]: Finished Cleanup of Temporary Directories.