How to convert rsyslog octal codes to ascii The Next CEO of Stack Overflowconfigure rsyslog...
My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?
Avoiding the "not like other girls" trope?
How can a day be of 24 hours?
Does int main() need a declaration on C++?
Compilation of a 2d array and a 1d array
Compensation for working overtime on Saturdays
Planeswalker Ability and Death Timing
Is a linearly independent set whose span is dense a Schauder basis?
Why do we say “un seul M” and not “une seule M” even though M is a “consonne”?
Masking layers by a vector polygon layer in QGIS
Creating a script with console commands
Why doesn't Shulchan Aruch include the laws of destroying fruit trees?
Incomplete cube
How to find if SQL server backup is encrypted with TDE without restoring the backup
What is the difference between 'contrib' and 'non-free' packages repositories?
Raspberry pi 3 B with Ubuntu 18.04 server arm64: what pi version
Is it correct to say moon starry nights?
How to coordinate airplane tickets?
My boss doesn't want me to have a side project
Find the majority element, which appears more than half the time
How to unfasten electrical subpanel attached with ramset
Ising model simulation
How can I separate the number from the unit in argument?
Man transported from Alternate World into ours by a Neutrino Detector
How to convert rsyslog octal codes to ascii
The Next CEO of Stack Overflowconfigure rsyslog server to log incomming messages with time of the rsyslog serverrsyslog block by dnsrsyslog loses messages from firewallSetup for rsyslog to log from two network devicesRsyslog: how to separate incoming logs with IP addressesrsyslog exclude logs based on hostnameDisable rsyslog remote server 's console messagesrsyslog changing file ownerSend specific rsyslog facility to remote server and not locallimiting rsyslog direct queue
Rsyslog by default uses octal codes to encode control codes and whitespace: #012
for newline, #011
for tab
A Google search only turned up results on how to convert octal codes using the standard 12
format rather than #012
.
How can I tail a log file and have the newlines and tabs displayed in the output rather than the octal codes that Rsyslog uses?
syslog
add a comment |
Rsyslog by default uses octal codes to encode control codes and whitespace: #012
for newline, #011
for tab
A Google search only turned up results on how to convert octal codes using the standard 12
format rather than #012
.
How can I tail a log file and have the newlines and tabs displayed in the output rather than the octal codes that Rsyslog uses?
syslog
add a comment |
Rsyslog by default uses octal codes to encode control codes and whitespace: #012
for newline, #011
for tab
A Google search only turned up results on how to convert octal codes using the standard 12
format rather than #012
.
How can I tail a log file and have the newlines and tabs displayed in the output rather than the octal codes that Rsyslog uses?
syslog
Rsyslog by default uses octal codes to encode control codes and whitespace: #012
for newline, #011
for tab
A Google search only turned up results on how to convert octal codes using the standard 12
format rather than #012
.
How can I tail a log file and have the newlines and tabs displayed in the output rather than the octal codes that Rsyslog uses?
syslog
syslog
asked Feb 19 at 4:42
IanBIanB
290210
290210
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The following perl one liner will translate the commonly used octal codes to ascii:
tail -f messages.log | perl -pe 's/#(011|012|015)/chr oct $1/ge'
Edit 2019-04-02: modified the regex to target specific octal codes
tail -f mysql-error.log | perl -pe 's/#(d{3})/chr oct $1/ge'
will work better if there are any 8-bit characters in that output, and it avoids eval. You said the error logs are from rsyslogd, so I'm not sure why you're tailing mysql's error log. But since you're also the OP I'm going along with it.
– Ed Grimm
Feb 19 at 4:48
@EdGrimm thanks for the suggestion. I've changed the log file name and removed eval. I'll stick with[0-7]
as that is the range of valid octal numbers. It'd be nice to have a better regex which won't replace, for example, sequences like#1234
withS4
– IanB
Feb 19 at 5:10
All of my personal servers are either upgraded to something using journald or using syslog-ng, so I can't check myself: does rsyslogd put something in the log to indicate the difference between a #number and an escape? If there's a character in front of the # to signal that condition, it would be appropriate for our substitution to just remove that character and leave the number unmolested in that case.
– Ed Grimm
Feb 19 at 5:15
add a comment |
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1407287%2fhow-to-convert-rsyslog-octal-codes-to-ascii%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The following perl one liner will translate the commonly used octal codes to ascii:
tail -f messages.log | perl -pe 's/#(011|012|015)/chr oct $1/ge'
Edit 2019-04-02: modified the regex to target specific octal codes
tail -f mysql-error.log | perl -pe 's/#(d{3})/chr oct $1/ge'
will work better if there are any 8-bit characters in that output, and it avoids eval. You said the error logs are from rsyslogd, so I'm not sure why you're tailing mysql's error log. But since you're also the OP I'm going along with it.
– Ed Grimm
Feb 19 at 4:48
@EdGrimm thanks for the suggestion. I've changed the log file name and removed eval. I'll stick with[0-7]
as that is the range of valid octal numbers. It'd be nice to have a better regex which won't replace, for example, sequences like#1234
withS4
– IanB
Feb 19 at 5:10
All of my personal servers are either upgraded to something using journald or using syslog-ng, so I can't check myself: does rsyslogd put something in the log to indicate the difference between a #number and an escape? If there's a character in front of the # to signal that condition, it would be appropriate for our substitution to just remove that character and leave the number unmolested in that case.
– Ed Grimm
Feb 19 at 5:15
add a comment |
The following perl one liner will translate the commonly used octal codes to ascii:
tail -f messages.log | perl -pe 's/#(011|012|015)/chr oct $1/ge'
Edit 2019-04-02: modified the regex to target specific octal codes
tail -f mysql-error.log | perl -pe 's/#(d{3})/chr oct $1/ge'
will work better if there are any 8-bit characters in that output, and it avoids eval. You said the error logs are from rsyslogd, so I'm not sure why you're tailing mysql's error log. But since you're also the OP I'm going along with it.
– Ed Grimm
Feb 19 at 4:48
@EdGrimm thanks for the suggestion. I've changed the log file name and removed eval. I'll stick with[0-7]
as that is the range of valid octal numbers. It'd be nice to have a better regex which won't replace, for example, sequences like#1234
withS4
– IanB
Feb 19 at 5:10
All of my personal servers are either upgraded to something using journald or using syslog-ng, so I can't check myself: does rsyslogd put something in the log to indicate the difference between a #number and an escape? If there's a character in front of the # to signal that condition, it would be appropriate for our substitution to just remove that character and leave the number unmolested in that case.
– Ed Grimm
Feb 19 at 5:15
add a comment |
The following perl one liner will translate the commonly used octal codes to ascii:
tail -f messages.log | perl -pe 's/#(011|012|015)/chr oct $1/ge'
Edit 2019-04-02: modified the regex to target specific octal codes
The following perl one liner will translate the commonly used octal codes to ascii:
tail -f messages.log | perl -pe 's/#(011|012|015)/chr oct $1/ge'
Edit 2019-04-02: modified the regex to target specific octal codes
edited 4 hours ago
answered Feb 19 at 4:42
IanBIanB
290210
290210
tail -f mysql-error.log | perl -pe 's/#(d{3})/chr oct $1/ge'
will work better if there are any 8-bit characters in that output, and it avoids eval. You said the error logs are from rsyslogd, so I'm not sure why you're tailing mysql's error log. But since you're also the OP I'm going along with it.
– Ed Grimm
Feb 19 at 4:48
@EdGrimm thanks for the suggestion. I've changed the log file name and removed eval. I'll stick with[0-7]
as that is the range of valid octal numbers. It'd be nice to have a better regex which won't replace, for example, sequences like#1234
withS4
– IanB
Feb 19 at 5:10
All of my personal servers are either upgraded to something using journald or using syslog-ng, so I can't check myself: does rsyslogd put something in the log to indicate the difference between a #number and an escape? If there's a character in front of the # to signal that condition, it would be appropriate for our substitution to just remove that character and leave the number unmolested in that case.
– Ed Grimm
Feb 19 at 5:15
add a comment |
tail -f mysql-error.log | perl -pe 's/#(d{3})/chr oct $1/ge'
will work better if there are any 8-bit characters in that output, and it avoids eval. You said the error logs are from rsyslogd, so I'm not sure why you're tailing mysql's error log. But since you're also the OP I'm going along with it.
– Ed Grimm
Feb 19 at 4:48
@EdGrimm thanks for the suggestion. I've changed the log file name and removed eval. I'll stick with[0-7]
as that is the range of valid octal numbers. It'd be nice to have a better regex which won't replace, for example, sequences like#1234
withS4
– IanB
Feb 19 at 5:10
All of my personal servers are either upgraded to something using journald or using syslog-ng, so I can't check myself: does rsyslogd put something in the log to indicate the difference between a #number and an escape? If there's a character in front of the # to signal that condition, it would be appropriate for our substitution to just remove that character and leave the number unmolested in that case.
– Ed Grimm
Feb 19 at 5:15
tail -f mysql-error.log | perl -pe 's/#(d{3})/chr oct $1/ge'
will work better if there are any 8-bit characters in that output, and it avoids eval. You said the error logs are from rsyslogd, so I'm not sure why you're tailing mysql's error log. But since you're also the OP I'm going along with it.– Ed Grimm
Feb 19 at 4:48
tail -f mysql-error.log | perl -pe 's/#(d{3})/chr oct $1/ge'
will work better if there are any 8-bit characters in that output, and it avoids eval. You said the error logs are from rsyslogd, so I'm not sure why you're tailing mysql's error log. But since you're also the OP I'm going along with it.– Ed Grimm
Feb 19 at 4:48
@EdGrimm thanks for the suggestion. I've changed the log file name and removed eval. I'll stick with
[0-7]
as that is the range of valid octal numbers. It'd be nice to have a better regex which won't replace, for example, sequences like #1234
with S4
– IanB
Feb 19 at 5:10
@EdGrimm thanks for the suggestion. I've changed the log file name and removed eval. I'll stick with
[0-7]
as that is the range of valid octal numbers. It'd be nice to have a better regex which won't replace, for example, sequences like #1234
with S4
– IanB
Feb 19 at 5:10
All of my personal servers are either upgraded to something using journald or using syslog-ng, so I can't check myself: does rsyslogd put something in the log to indicate the difference between a #number and an escape? If there's a character in front of the # to signal that condition, it would be appropriate for our substitution to just remove that character and leave the number unmolested in that case.
– Ed Grimm
Feb 19 at 5:15
All of my personal servers are either upgraded to something using journald or using syslog-ng, so I can't check myself: does rsyslogd put something in the log to indicate the difference between a #number and an escape? If there's a character in front of the # to signal that condition, it would be appropriate for our substitution to just remove that character and leave the number unmolested in that case.
– Ed Grimm
Feb 19 at 5:15
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1407287%2fhow-to-convert-rsyslog-octal-codes-to-ascii%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown