I am trying to automatically format syslog data from cygwin64 to print out with line breaks at the end of each line, so I can do some parsing later on. However, I don't see any configs that could yield a solution. How can I properly format the syslog data?
Asked
Active
Viewed 485 times
0
-
Hi, could you clarify the problem and the environment a bit? From the tags I guess that you are running sshd under cygwin, and use syslog-ng to write the logs into a file, but there is some problem with the line breaks. Is that right? – Robert Fekete Jun 21 '16 at 11:46
-
I apologize @RobertFekete, I should have been more specific. Yes you are correct, sshd with syslog-ng. I am checking the /var/log/messages directory to see the writing of the sys log data to a text file, but it all comes up on one line, rather than one line per sys log message. Should I provide any more specifics? Thanks for the response btw. – M. Barbieri Jun 21 '16 at 12:10
-
Do you use any specific template to format the messages? It might be that the linebreak character (\n) is not handled properly on windows. Try adding a \r to the template, for example: destination d_file { file ("/var/log/messages" template("${ISODATE} ${HOST} ${MSG}\r\n") ); }; – Robert Fekete Jun 21 '16 at 14:34
-
That worked! Thank you! Please post it as answer so I can give some rep! @RobertFekete – M. Barbieri Jun 21 '16 at 16:28
-
Glad that it worked! – Robert Fekete Jun 22 '16 at 08:04
1 Answers
0
Do you use any specific template to format the messages? It might be that the linebreak character (\n) is not handled properly on windows. Try adding a \r to the template, for example:
destination d_file { file ("/var/log/messages" template("${ISODATE} ${HOST} ${MSG}\r\n") ); };

Robert Fekete
- 552
- 1
- 3
- 6
-
I just realized I have 13 rep and I need 15 to give you rep! lol sorry. I'll upvote this soon! – M. Barbieri Jun 22 '16 at 12:22