It is possible to change logger message date format in OpenWrt

it is possible to change logger message date format in openwrt

pipe logread to awk or sed

I want to change syslog prefix date format or facility code

Here's an example on how to do that: logread(){ /sbin/logread $@ | awk '{$1=$2=$3=$5=$6=""; print $0}' | sed 's/\s\+/ /g;s/^ //;'; }.

1 Like

HI @stangri,
Thanks for reply..
But, where i want to put this function

1 Like

You can't change what the default logger in OpenWrt logs, just post-process it into another form, as far as I know.

If you want more sophisticated logging, I'd suggest looking at syslog-ng, rsyslogd, or another logging package, as well as logrotate or the like to manage file-based logging.

Like the suggestions above say, you can change the processing of the text format output of logread to format the string with some creative usage of Linux text manipulation tools.

Or alternatively, compile a personal version of ubox (that contains the default logging), and change the output format directly there.

By default, the date/time output is formatted with "ctime" function in logread.c.;a=blob;f=log/logread.c;h=e47541a19f5aaef724f1118a0ad26b7a0619d5ea;hb=HEAD#l147

The same function in logread.c contains pretty much all log output formatting tasks that are done.


  • it is not possibly to configure by any normal easy-to-use setting
  • it is possible to format/edit the text output via script tools, like suggested above.
  • if you are familiar with the Openwrt build/compile environment, you can tailor the logging output as you want, by modifying the source code directly and compiling a personal version of the logging output tool (logread).
1 Like

Thank you @jeff @hnyman

Hi @hnyman,
I try with logread.c file to change time format