Filter screenlog with screen command
Clash Royale CLAN TAG#URR8PPP
Pressing Ctrl+A, H, lets me log output of the screen
command. However, the output file is too large.
Is it possible to apply a grep
-like filter so that I can control what gets logged?
For example, I might wish to log only lines which contain the phrase foo bar
.
grep gnu-screen
add a comment |
Pressing Ctrl+A, H, lets me log output of the screen
command. However, the output file is too large.
Is it possible to apply a grep
-like filter so that I can control what gets logged?
For example, I might wish to log only lines which contain the phrase foo bar
.
grep gnu-screen
add a comment |
Pressing Ctrl+A, H, lets me log output of the screen
command. However, the output file is too large.
Is it possible to apply a grep
-like filter so that I can control what gets logged?
For example, I might wish to log only lines which contain the phrase foo bar
.
grep gnu-screen
Pressing Ctrl+A, H, lets me log output of the screen
command. However, the output file is too large.
Is it possible to apply a grep
-like filter so that I can control what gets logged?
For example, I might wish to log only lines which contain the phrase foo bar
.
grep gnu-screen
grep gnu-screen
edited Jul 2 '15 at 12:39
G-Man
13.6k93768
13.6k93768
asked Jul 2 '15 at 12:10
curryagecurryage
1063
1063
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Interesting question. I just skimmed through man screen
so I am not absolutely sure whether it is possible to achieve without using external tools. However, one can use a named pipe and a combination of tail and grep to do this:
$ mkfifo /tmp/fifo/fifo
$ tail -f /tmp/fifo/fifo | grep --line-buffered bar >> /tmp/DONE
Inside screen
do:
logfile /tmp/fifo/fifo
and start logging. After finishing logging only lines that contained bar
will be saved in /tmp/DONE
. As it states in man fifo
:
A FIFO special file (a named pipe) is similar to a pipe, except that
it is accessed as part of the file system. It can be opened by
multiple processes for reading or writ- ing. When processes are
exchanging data via the FIFO, the kernel passes all data internally
without writing it to the file system. Thus, the FIFO special file has
no con- tents on the file system; the file system entry merely serves
as a reference point so that processes can access the pipe using a
name in the file system.
That means that /tmp/fifo/fifo
takes no space on disk. This solution worked for me but I don't know what negative side-effects or shortcomings it may have.
EDIT:
I just noticed that they recommend using fifo
in man script
:
-f, --flush Flush output after each write. This is nice for telecooperation: one person does 'mkfifo foo; script -f foo', and
another can supervise real-time what is being done using 'cat foo'.
In case you didn't know, script is an utility that also records terminal session.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f213516%2ffilter-screenlog-with-screen-command%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
Interesting question. I just skimmed through man screen
so I am not absolutely sure whether it is possible to achieve without using external tools. However, one can use a named pipe and a combination of tail and grep to do this:
$ mkfifo /tmp/fifo/fifo
$ tail -f /tmp/fifo/fifo | grep --line-buffered bar >> /tmp/DONE
Inside screen
do:
logfile /tmp/fifo/fifo
and start logging. After finishing logging only lines that contained bar
will be saved in /tmp/DONE
. As it states in man fifo
:
A FIFO special file (a named pipe) is similar to a pipe, except that
it is accessed as part of the file system. It can be opened by
multiple processes for reading or writ- ing. When processes are
exchanging data via the FIFO, the kernel passes all data internally
without writing it to the file system. Thus, the FIFO special file has
no con- tents on the file system; the file system entry merely serves
as a reference point so that processes can access the pipe using a
name in the file system.
That means that /tmp/fifo/fifo
takes no space on disk. This solution worked for me but I don't know what negative side-effects or shortcomings it may have.
EDIT:
I just noticed that they recommend using fifo
in man script
:
-f, --flush Flush output after each write. This is nice for telecooperation: one person does 'mkfifo foo; script -f foo', and
another can supervise real-time what is being done using 'cat foo'.
In case you didn't know, script is an utility that also records terminal session.
add a comment |
Interesting question. I just skimmed through man screen
so I am not absolutely sure whether it is possible to achieve without using external tools. However, one can use a named pipe and a combination of tail and grep to do this:
$ mkfifo /tmp/fifo/fifo
$ tail -f /tmp/fifo/fifo | grep --line-buffered bar >> /tmp/DONE
Inside screen
do:
logfile /tmp/fifo/fifo
and start logging. After finishing logging only lines that contained bar
will be saved in /tmp/DONE
. As it states in man fifo
:
A FIFO special file (a named pipe) is similar to a pipe, except that
it is accessed as part of the file system. It can be opened by
multiple processes for reading or writ- ing. When processes are
exchanging data via the FIFO, the kernel passes all data internally
without writing it to the file system. Thus, the FIFO special file has
no con- tents on the file system; the file system entry merely serves
as a reference point so that processes can access the pipe using a
name in the file system.
That means that /tmp/fifo/fifo
takes no space on disk. This solution worked for me but I don't know what negative side-effects or shortcomings it may have.
EDIT:
I just noticed that they recommend using fifo
in man script
:
-f, --flush Flush output after each write. This is nice for telecooperation: one person does 'mkfifo foo; script -f foo', and
another can supervise real-time what is being done using 'cat foo'.
In case you didn't know, script is an utility that also records terminal session.
add a comment |
Interesting question. I just skimmed through man screen
so I am not absolutely sure whether it is possible to achieve without using external tools. However, one can use a named pipe and a combination of tail and grep to do this:
$ mkfifo /tmp/fifo/fifo
$ tail -f /tmp/fifo/fifo | grep --line-buffered bar >> /tmp/DONE
Inside screen
do:
logfile /tmp/fifo/fifo
and start logging. After finishing logging only lines that contained bar
will be saved in /tmp/DONE
. As it states in man fifo
:
A FIFO special file (a named pipe) is similar to a pipe, except that
it is accessed as part of the file system. It can be opened by
multiple processes for reading or writ- ing. When processes are
exchanging data via the FIFO, the kernel passes all data internally
without writing it to the file system. Thus, the FIFO special file has
no con- tents on the file system; the file system entry merely serves
as a reference point so that processes can access the pipe using a
name in the file system.
That means that /tmp/fifo/fifo
takes no space on disk. This solution worked for me but I don't know what negative side-effects or shortcomings it may have.
EDIT:
I just noticed that they recommend using fifo
in man script
:
-f, --flush Flush output after each write. This is nice for telecooperation: one person does 'mkfifo foo; script -f foo', and
another can supervise real-time what is being done using 'cat foo'.
In case you didn't know, script is an utility that also records terminal session.
Interesting question. I just skimmed through man screen
so I am not absolutely sure whether it is possible to achieve without using external tools. However, one can use a named pipe and a combination of tail and grep to do this:
$ mkfifo /tmp/fifo/fifo
$ tail -f /tmp/fifo/fifo | grep --line-buffered bar >> /tmp/DONE
Inside screen
do:
logfile /tmp/fifo/fifo
and start logging. After finishing logging only lines that contained bar
will be saved in /tmp/DONE
. As it states in man fifo
:
A FIFO special file (a named pipe) is similar to a pipe, except that
it is accessed as part of the file system. It can be opened by
multiple processes for reading or writ- ing. When processes are
exchanging data via the FIFO, the kernel passes all data internally
without writing it to the file system. Thus, the FIFO special file has
no con- tents on the file system; the file system entry merely serves
as a reference point so that processes can access the pipe using a
name in the file system.
That means that /tmp/fifo/fifo
takes no space on disk. This solution worked for me but I don't know what negative side-effects or shortcomings it may have.
EDIT:
I just noticed that they recommend using fifo
in man script
:
-f, --flush Flush output after each write. This is nice for telecooperation: one person does 'mkfifo foo; script -f foo', and
another can supervise real-time what is being done using 'cat foo'.
In case you didn't know, script is an utility that also records terminal session.
edited Jul 2 '15 at 17:41
answered Jul 2 '15 at 17:34
Arkadiusz DrabczykArkadiusz Drabczyk
8,30521836
8,30521836
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f213516%2ffilter-screenlog-with-screen-command%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