Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to remove what between "[" .. "]" in dmesg ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
legacy
n00b
n00b


Joined: 10 Sep 2012
Posts: 47

PostPosted: Thu Jul 04, 2013 3:13 pm    Post subject: how to remove what between "[" .. "]" in Reply with quote

Hi
i have a 3.4.13 kernel which is annoying me with timestamp between "[" .. "]", i have removed the CONFIG_PRINTK_TIME -> kernel/printk.c, but i am still having this dmesg

Code:

[    3.867299] Bluetooth: RFCOMM socket layer initialized
[    3.867416] Bluetooth: RFCOMM ver 1.11
[    3.867519] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[    3.867637] Bluetooth: HIDP socket layer initialized
[    3.868222] Using IPI No-Shortcut mode
[    3.868634] PM: Hibernation image not present or could not be loaded.
[    3.868641] registered taskstats version 1
[    3.870378] ALSA device list:
[    3.870494]   #0: HDA NVidia at 0xd3480000 irq 22
[    3.923858] kjournald starting.  Commit interval 5 seconds
[    3.923914] EXT3-fs (sda3): mounted filesystem with ordered data mode
[    3.923926] VFS: Mounted root (ext3 filesystem) readonly on device 8:3.
[    3.931409] apple 0003:05AC:8242.0001: hiddev0,hidraw0: USB HID v1.11 Device [Apple Computer, Inc. IR Receiver] on usb-0000:00:04.0-5/input0
[    3.957974] devtmpfs: mounted



How to remove [%lu.%lu] ???
Back to top
View user's profile Send private message
aCOSwt
Moderator
Moderator


Joined: 19 Oct 2007
Posts: 2375
Location: Hilbert space

PostPosted: Thu Jul 04, 2013 3:23 pm    Post subject: Re: how to remove what between "[" .. "]" Reply with quote

legacy wrote:
How to remove [%lu.%lu] ???

Code:
dmesg --notime

_________________
Back to top
View user's profile Send private message
legacy
n00b
n00b


Joined: 10 Sep 2012
Posts: 47

PostPosted: Fri Jul 05, 2013 1:13 pm    Post subject: Reply with quote

yes, but is it possible to remove it from the kernel support ? In case which option is it ?
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1348

PostPosted: Fri Jul 05, 2013 3:35 pm    Post subject: Reply with quote

CONFIG_PRINTK_TIME indeed does; sounds to me you are adding support for it in another place, perhaps the kernel command line.
Back to top
View user's profile Send private message
legacy
n00b
n00b


Joined: 10 Sep 2012
Posts: 47

PostPosted: Fri Jul 05, 2013 7:25 pm    Post subject: Reply with quote

cat /proc/cmdline

root=/dev/sda3 root=/dev/sda3 CONSOLE=/dev/tty1
Back to top
View user's profile Send private message
aCOSwt
Moderator
Moderator


Joined: 19 Oct 2007
Posts: 2375
Location: Hilbert space

PostPosted: Sat Jul 06, 2013 5:46 pm    Post subject: Reply with quote

Unselecting CONFIG_PRINTK_TIME does indeed prevent the kernel to provide the timestamp but will obviously not prevent your logging system (sys/meta/whatever-log) to add its own one.
(Far less accurate than kernel's one of course).
Which makes dmesg --notime, the only practical answer to your original question (How to remove [%lu.%lu] in dmesg???)
_________________
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1348

PostPosted: Sat Jul 06, 2013 6:06 pm    Post subject: Reply with quote

Indeed, and if you are bothered by having to type the parameter you could add something like this to ~/.bashrc (translate if you use a different shell):

Quote:
alias dmesg="dmesg --notime"
Back to top
View user's profile Send private message
legacy
n00b
n00b


Joined: 10 Sep 2012
Posts: 47

PostPosted: Fri Jul 12, 2013 10:22 pm    Post subject: Reply with quote

so dmesg is only filtering what between "[" and ']'. Who is adding the timestamp ? You have said the logger, is it possible to hack it ?
Back to top
View user's profile Send private message
legacy
n00b
n00b


Joined: 10 Sep 2012
Posts: 47

PostPosted: Fri Jul 12, 2013 10:27 pm    Post subject: Reply with quote

the kernel is putting log into /dev/kmsg, i see it adds something to every line, how to remove it ? should i hack the kernel ?
Back to top
View user's profile Send private message
legacy
n00b
n00b


Joined: 10 Sep 2012
Posts: 47

PostPosted: Fri Jul 12, 2013 10:42 pm    Post subject: Reply with quote

Code:


config PRINTK_TIME
        bool "Show timing information on printks"
        depends on PRINTK
        help
          Selecting this option causes time stamps of the printk()
          messages to be added to the output of the syslog() system
          call and at the console.

          The timestamp is always recorded internally, and exported
          to /dev/kmsg. This flag just specifies if the timestamp should
          be included, not that the timestamp is recorded.

          The behavior is also controlled by the kernel command line
          parameter printk.time=1. See Documentation/kernel-parameters.txt

Back to top
View user's profile Send private message
legacy
n00b
n00b


Joined: 10 Sep 2012
Posts: 47

PostPosted: Fri Jul 12, 2013 10:47 pm    Post subject: Reply with quote

kernel/printk.c
Code:

 ...
 * The 'struct log' buffer header must never be directly exported to
 * userspace, it is a kernel-private implementation detail that might
 * need to be changed in the future, when the requirements change.
 *
 * /dev/kmsg exports the structured data in the following line format:
 *   "level,sequnum,timestamp;<message text>\n"
 *
 * The optional key/value pairs are attached as continuation lines starting
 * with a space character and terminated by a newline. All possible
 * non-prinatable characters are escaped in the "\xff" notation.
 *
 * Users of the export format should ignore possible additional values
 * separated by ',', and find the message after the ';' character.
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1223
Location: 42.68n 85.41w

PostPosted: Fri Jul 12, 2013 11:24 pm    Post subject: Reply with quote

sed is a stream editor, you want to edit the contents of your brackets out of your stream..... ie. pipe dmesg through sed.

Code:

dmesg | sed -e 's/\[[^][]*\]//g'


:D
_________________
cat /etc/*-release
Funtoo Linux - baselayout 2.2.0
consider this warning no. 1
http://ecx.images-amazon.com/images/I/81Ku-vxIb3L._SL1500_.jpg
http://wiki.gentoo.org/wiki/Special:Contributions/666threesixes666
Back to top
View user's profile Send private message
aCOSwt
Moderator
Moderator


Joined: 19 Oct 2007
Posts: 2375
Location: Hilbert space

PostPosted: Sat Jul 13, 2013 9:02 am    Post subject: Reply with quote

legacy wrote:
so dmesg is only filtering what between "[" and ']'. Who is adding the timestamp ? You have said the logger, is it possible to hack it ?

The rfc5424 does not exactly appear to me as belonging to the april's joke category of rfcs.
So... feel free... to be on your own.
_________________
Back to top
View user's profile Send private message
legacy
n00b
n00b


Joined: 10 Sep 2012
Posts: 47

PostPosted: Sat Jul 13, 2013 11:49 pm    Post subject: Reply with quote

aCOSwt wrote:
legacy wrote:
so dmesg is only filtering what between "[" and ']'. Who is adding the timestamp ? You have said the logger, is it possible to hack it ?

The rfc5424 does not exactly appear to me as belonging to the april's joke category of rfcs.
So... feel free... to be on your own.


Well, why should i add rules on bashrc ? why should i process the output of /dev/kmsg in order to filter the damn verbosity ? I want simpler stuff, i want a kernel that puts out clean things, also older kernel (e.g. 2.6.39) are not so verbose.

Anyway i will hack the kernel, i do not need any sys logger at all.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum