converting #012 from syslog

Here developers can talk about how to write a Parser for LogMX

Moderator: admin

Post Reply
mrobinson108
Posts: 10
Joined: Mon Jul 02, 2018 6:17 pm

converting #012 from syslog

Post by mrobinson108 » Mon Jul 02, 2018 6:21 pm

I understand that syslog wants a single line as a message and converts new lines to #012. Is there any reasonable way to convert those back to a new line when parsing the syslog? Currently I am using a Logback pattern

%d{MMM dd HH:mm:ss} %t %p %c{0} - %m - %X{username} : %X{company}

admin
Site Admin
Posts: 507
Joined: Sun Dec 17, 2006 10:30 pm

Re: converting #012 from syslog

Post by admin » Tue Jul 03, 2018 2:57 am

Hello,

There's no easy trivial way to do it, but with a few lines of Java you can write your own Parser and import it in LogMX. I attached to this post (see link below) a Parser that should do the trick for you. To import it, just go to menu "File" > "Configure Log Parsers...", then click on the import button (last button at the right), then pick the attached file. You may also want to disable/remove your Logback pattern parser so that LogMX won't try to use it anymore.

Plan B: disable #012 and #015 in syslog using this trick: https://stackoverflow.com/questions/246 ... 12-and-015

Please let me know how it goes!

Xavier
Attachments
logmx.parser.export
(4.28 KiB) Downloaded 46 times

mrobinson108
Posts: 10
Joined: Mon Jul 02, 2018 6:17 pm

Re: converting #012 from syslog

Post by mrobinson108 » Tue Jul 03, 2018 8:56 pm

I tried importing your custom parser with no luck. I'll attach the screenshot.

The other suggestion might be simpler. I'll take a look at the option as well. I'll let you know.

Thanks for the help.
Attachments
Screen Shot 2018-07-03 at 1.50.17 PM.png
Screen Shot 2018-07-03 at 1.50.17 PM.png (20.04 KiB) Viewed 7034 times

admin
Site Admin
Posts: 507
Joined: Sun Dec 17, 2006 10:30 pm

Re: converting #012 from syslog

Post by admin » Wed Jul 04, 2018 2:17 am

Sorry about that, I see what happened (bug while importing the Parser on macOS, and on top of that I compiled this Parser with Java 9). Please use the attached ZIP file to manually import the Parser:
  • copy the ".class" file from this ZIP in LogMX directory "parsers/classes/sample/parser",
  • copy the ".java" file from this ZIP in LogMX directory "parsers/src/sample/parser",
  • go to menu "File" > "Configure Log Parsers" and click the green "+" button at the right
  • (optional, the link to the Parser that you previously tried to import can be reused) go to tab "Java class Parser" and in the tree nodes "<LogMX-dir>/parsers/classes" then "sample.parser", select "CustomSyslogParser", and validate dialogs
Xavier
Attachments
parser.zip
(3.91 KiB) Downloaded 41 times

mrobinson108
Posts: 10
Joined: Mon Jul 02, 2018 6:17 pm

mrobinson108

Post by mrobinson108 » Fri Jul 06, 2018 4:56 pm

No problem. Thanks for the update.

BTW, I did try the Plan B method as well. It worked like a charm. Thanks for pointing it out.

Post Reply