ccze (Log colorizer) shows no output when filtering certain strings. Why? - bash

I am using a (bash) alias on an Ubuntu 22.04 system to quickly tail the system log without all the garbage that usually is of no importance. (I do want all this logged, but not displayed all the time.) The current alias looks something like this:
$ tail -f --lines=200 /var/log/syslog | \
egrep -v "(named\[.*\]: (REFUSED unexpected RCODE|timed out) resolving)|\[INFO\] (New connection from ::1|Logout.)"
This works fine and give me some output:
Dec 7 13:32:15 root named[1044]: clients-per-query decreased to 20
Dec 7 13:32:29 root mariadbd[1188]: 2022-12-07 13:32:29 83187 [Warning] Aborted connection 83187 to db: 'XXX' user: 'XXX' host: 'localhost' (Got an error reading communication packets)
Dec 7 13:32:39 root named[1044]: connection refused resolving '_.168.192.bl.blocklist.de/A/IN': 46.252.24.212#53
Dec 7 13:32:39 root named[1044]: connection refused resolving '_.215.85.bl.blocklist.de/A/IN': 46.252.24.212#53
Dec 7 13:39:00 root systemd[1]: Starting Clean php session files...
Dec 7 13:39:03 root systemd[1]: phpsessionclean.service: Deactivated successfully.
Dec 7 13:39:03 root systemd[1]: Finished Clean php session files.
Dec 7 13:39:03 root systemd[1]: phpsessionclean.service: Consumed 3.081s CPU time.
Dec 7 13:52:15 root named[1044]: clients-per-query decreased to 19
Dec 7 13:53:06 root named[1044]: connection refused resolving '_.54.142.bl.blocklist.de/A/IN': 46.252.24.212#53
Dec 7 13:55:58 root mariadbd[1188]: 2022-12-07 13:55:58 83536 [Warning] Access denied for user 'xxx'#'localhost' (using password: YES)
Dec 7 13:55:58 root mariadbd[1188]: 2022-12-07 13:55:58 83537 [Warning] Access denied for user ''#'localhost' (using password: NO)
Dec 7 13:59:01 root kernel: [241023.546785] sh (1569030): drop_caches: 3
Dec 7 14:04:19 root freshclam[1929]: Wed Dec 7 14:04:19 2022 -> Received signal: wake up
Dec 7 14:04:19 root freshclam[1929]: Wed Dec 7 14:04:19 2022 -> ClamAV update process started at Wed Dec 7 14:04:19 2022
Dec 7 14:04:19 root freshclam[1929]: Wed Dec 7 14:04:19 2022 -> ^Your ClamAV installation is OUTDATED!
Dec 7 14:04:19 root freshclam[1929]: Wed Dec 7 14:04:19 2022 -> ^Local version: 0.103.6 Recommended version: 0.103.7
Dec 7 14:04:19 root freshclam[1929]: Wed Dec 7 14:04:19 2022 -> DON'T PANIC! Read https://docs.clamav.net/manual/Installing.html
Dec 7 14:04:19 root freshclam[1929]: Wed Dec 7 14:04:19 2022 -> daily.cld database is up-to-date (version: 26743, sigs: 2013590, f-level: 90, builder: raynman)
Dec 7 14:04:19 root freshclam[1929]: Wed Dec 7 14:04:19 2022 -> main.cvd database is up-to-date (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)
Dec 7 14:04:19 root freshclam[1929]: Wed Dec 7 14:04:19 2022 -> bytecode.cvd database is up-to-date (version: 333, sigs: 92, f-level: 63, builder: awillia2)
Dec 7 14:04:52 root named[1044]: validating _spf.eu.mailgun.org/TXT: no valid signature found
Dec 7 14:09:00 root systemd[1]: Starting Clean php session files...
Dec 7 14:09:03 root systemd[1]: phpsessionclean.service: Deactivated successfully.
Dec 7 14:09:03 root systemd[1]: Finished Clean php session files.
Dec 7 14:09:03 root systemd[1]: phpsessionclean.service: Consumed 3.038s CPU time.
Dec 7 14:09:38 root clamd[489]: Wed Dec 7 14:09:38 2022 -> SelfCheck: Database status OK.
However, when I pipe this output through ccze, I get no output at all:
$ tail -f --lines=200 /var/log/syslog | \
egrep -v "(named\[.*\]: (REFUSED unexpected RCODE|timed out) resolving)|\[INFO\] (New connection from ::1|Logout.)" | \
ccze -A
It gets weirder: after removing the RCODE line from my exclusion list it works:
$ tail -f --lines=200 /var/log/syslog | \
egrep -v "(named\[.*\]: timed out resolving)|\[INFO\] (New connection from ::1|Logout.)" | \
ccze -A
Dec 7 13:32:15 root named[1044]: clients-per-query decreased to 20
Dec 7 13:32:29 root mariadbd[1188]: 2022-12-07 13:32:29 83187 [Warning] Aborted connection 83187 to db: 'xxx' user: 'xxx' host: 'localhost' (Got an error reading communication packets)
Dec 7 13:32:39 root named[1044]: connection refused resolving '_.168.192.bl.blocklist.de/A/IN': 46.252.24.212#53
(...)
And if I first cat the syslog to a file and then pipe it through ccze, it also works:
$ tail --lines=200 /var/log/syslog | \
egrep -v "(named\[.*\]: (REFUSED unexpected RCODE|timed out) resolving)|\[INFO\] (New connection from ::1|Logout.)" \
> syslog-ccze.bug
$ cat syslog-ccze.bug | ccze -A
Dec 7 13:32:15 root named[1044]: clients-per-query decreased to 20
Dec 7 13:32:29 root mariadbd[1188]: 2022-12-07 13:32:29 83187 [Warning] Aborted connection 83187 to db: 'xxx' user: 'xxx' host: 'localhost' (Got an error reading communication packets)
Dec 7 13:32:39 root named[1044]: connection refused resolving '_.168.192.bl.blocklist.de/A/IN': 46.252.24.212#53
(...)
For some reason, ccze doesn't like me filtering out the "unexpected RCODE" named messages. Am I missing something obvious, or am I hitting some weird race condition in ccze, or what is happening?

Bah. Once you take the time to actually write down your question, you'll find answers by yourself. :-(
ccze apparently has an internal buffer. It needs a minimum amount of lines before outputting ANYTHING. Increasing the --lines= parameter for tail in my alias helped.
This seems to be undocumented behaviour, so I'll leave the question here to be searchable. Hope it helps and saves you some time. :-)

Related

Macbook pro Manjaro bluetooth not working

I'm not sure if this is the write place to write my question, but here it is.
Before a week i updated my macbook pro early 2015 with manjaro gnom.
All good, but the bluetooth is not working.
I tried with bluetooth-manager but it's not opening and inside the journalctl -f it's showing
Oct 15 20:08:59 PPeev systemd[1095]: Started Application launched by gnome-shell.
Oct 15 20:09:00 PPeev blueman-manager.desktop[5014]: blueman-manager 20.09.00 ERROR Manager:118 on_dbus_name_appeared: Default adapter not found, trying first available.
Oct 15 20:09:00 PPeev blueman-manager.desktop[5014]: blueman-manager 20.09.00 ERROR Manager:122 on_dbus_name_appeared: No adapter(s) found, exiting
Oct 15 20:09:00 PPeev blueman-manager.desktop[5014]: blueman-manager version 2.1.3 starting
Oct 15 20:09:00 PPeev systemd[1095]: gnome-launched-blueman-manager.desktop-5014.scope: Succeeded.
Oct 15 20:09:04 PPeev systemd[1095]: gnome-terminal-server.service: Succeeded.
Also when i check the status systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2020-10-15 19:52:23 EEST; 19min ago
Docs: man:bluetoothd(8)
Main PID: 1083 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 9413)
Memory: 2.3M
CGroup: /system.slice/bluetooth.service
└─1083 /usr/lib/bluetooth/bluetoothd
Oct 15 19:52:23 PPeev bluetoothd[1083]: src/main.c:parse_controller_config() Key file does not have key “LEScanIntervalConnect” in group “Controller”
Oct 15 19:52:23 PPeev bluetoothd[1083]: src/main.c:parse_controller_config() Key file does not have key “LEScanWindowConnect” in group “Controller”
Oct 15 19:52:23 PPeev bluetoothd[1083]: src/main.c:parse_controller_config() Key file does not have key “LEMinConnectionInterval” in group “Controller”
Oct 15 19:52:23 PPeev bluetoothd[1083]: src/main.c:parse_controller_config() Key file does not have key “LEMaxConnectionInterval” in group “Controller”
Oct 15 19:52:23 PPeev bluetoothd[1083]: src/main.c:parse_controller_config() Key file does not have key “LEConnectionLatency” in group “Controller”
Oct 15 19:52:23 PPeev bluetoothd[1083]: src/main.c:parse_controller_config() Key file does not have key “LEConnectionSupervisionTimeout” in group “Controller”
Oct 15 19:52:23 PPeev bluetoothd[1083]: src/main.c:parse_controller_config() Key file does not have key “LEAutoconnecttimeout” in group “Controller”
Oct 15 19:52:23 PPeev systemd[1]: Started Bluetooth service.
Oct 15 19:52:23 PPeev bluetoothd[1083]: Starting SDP server
Oct 15 19:52:23 PPeev bluetoothd[1083]: Bluetooth management interface 1.17 initialized
Is running.
try disabling and re-enabling the bluetooth from the bios menu.
I checked some threads, and the only working option i got is this.
You may try this. I guess it will work for you too.

Unexpected Error at Installing CS6 on macOS 10.12

I want re-install my licensed CS6 Web & Design Premium os macOS 10.12 Sierra. However, installer says "Could not start the installation. Any file may be missing."
I got the PDapp.log which created by installer in /Libary/Logs.
The Log:
Wed Oct 12 19:34:00 2016 [INFO] Setup - Build Version - 6.0.335.0
Wed Oct 12 19:34:00 2016 [INFO] Setup - Logging Level verbosity Set to 4
Wed Oct 12 19:34:00 2016 [INFO] Setup - TimeLog: Bootstrapper Start
Wed Oct 12 19:34:00 2016 [INFO] Setup - TimeLog: Start initial checks
Wed Oct 12 19:34:00 2016 [INFO] Setup - Launch Path set to /var/folders/ln/ljj38hdx5f13q0db1q58bpsr0000gp/T/AppTranslocation/E0C66AE8-34B2-4A80-A424-D031D2709AEA/d
Wed Oct 12 19:34:00 2016 [INFO] Setup - Found 6 packages in setup manifest
Wed Oct 12 19:34:00 2016 [INFO] PIM - Build Version - 6.0.335.0
Wed Oct 12 19:34:00 2016 [INFO] PIM - Logging Level verbosity Set to 4
Wed Oct 12 19:34:00 2016 [WARN] PIM - Detected Old content in USF trying to delete it...
Wed Oct 12 19:34:00 2016 [WARN] PIM - Successfully deleted old content...
Wed Oct 12 19:34:00 2016 [INFO] PIM - Build Version - 6.0.335.0
Wed Oct 12 19:34:00 2016 [INFO] PIM - Logging Level verbosity Set to 4
Wed Oct 12 19:34:00 2016 [INFO] PIM - CREATE PIM Instance ...
Wed Oct 12 19:34:00 2016 [INFO] PIM - trying to createOrUpdatePIMDbSchema.
Wed Oct 12 19:34:00 2016 [INFO] PIM - SUCCESS Created Tables.
Wed Oct 12 19:34:00 2016 [INFO] PIM - PIM Database is Up To Date.
Wed Oct 12 19:34:00 2016 [INFO] PIM - Updater Inventory location:/var/folders/ln/ljj38hdx5f13q0db1q58bpsr0000gp/T/AppTranslocation/E0C66AE8-34B2-4A80-A424-D031D2709AEA/d/Install.app/Contents/Frameworks/UpdaterInventory.framework/UpdaterInventory
Wed Oct 12 19:34:00 2016 [FATAL] PIM - ERROR invalid xml file path. Could not read data from path /var/folders/ln/ljj38hdx5f13q0db1q58bpsr0000gp/T/AppTranslocation/E0C66AE8-34B2-4A80-A424-D031D2709AEA/d/packages/core/PDApp.pimx
Wed Oct 12 19:34:00 2016 [FATAL] PIM - Error Description Error Domain=NSCocoaErrorDomain Code=260 "The file “PDApp.pimx” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/var/folders/ln/ljj38hdx5f13q0db1q58bpsr0000gp/T/AppTranslocation/E0C66AE8-34B2-4A80-A424-D031D2709AEA/d/packages/core/PDApp.pimx, NSUnderlyingError=0x23add0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
Wed Oct 12 19:34:00 2016 [ERROR] PIM - Error couldnot initialize XML. Improper xml file.
Wed Oct 12 19:34:00 2016 [ERROR] Setup - Error in initialization. Manifest parsing failed.
Wed Oct 12 19:34:00 2016 [INFO] Setup - TimeLog: End initial checks
Wed Oct 12 19:34:02 2016 [INFO] Setup - ================= Exiting Installer with Code: 0 =================
Wed Oct 12 19:34:02 2016 [INFO] PIM - PIMSqlite closeDB status 0
Wed Oct 12 19:34:02 2016 [INFO] PIM - FREE PIM Instance ...
How can I fix this error?
Thanks.
For OSX 10.12.X (Sierra) run installer directly from Install.app/Contents/MacOS/Install

Jmeter test, takes always the same time between start and finish

Jmeter is taking always the same time to finish remote test. The jmx script is simple and there is no time configured on it, and there are just one request (only 84ms in local test).
It happens only on remote test, in local test is ok.
Starting the test on host x.x.x.x # Thu Aug 14 09:31:43 BRT 2014 (1408019503091)
Finished the test on host x.x.x.x # Thu Aug 14 09:34:43 BRT 2014 (1408019683082)
Starting the test on host x.x.x.x # Thu Aug 14 09:35:53 BRT 2014 (1408019753107)
Finished the test on host x.x.x.x # Thu Aug 14 09:38:53 BRT 2014 (1408019933091)
Starting the test on host x.x.x.x # Thu Aug 14 09:40:33 BRT 2014 (1408020033110)
Finished the test on host x.x.x.x # Thu Aug 14 09:43:33 BRT 2014 (1408020213100)
Starting the test on host x.x.x.x # Thu Aug 14 10:03:23 BRT 2014 (1408021403158)
Finished the test on host x.x.x.x # Thu Aug 14 10:06:23 BRT 2014 (1408021583154)
Starting the test on host x.x.x.x # Thu Aug 14 10:07:53 BRT 2014 (1408021673181)
Finished the test on host x.x.x.x # Thu Aug 14 10:10:53 BRT 2014 (1408021853164)
Starting the test on host x.x.x.x # Thu Aug 14 10:25:23 BRT 2014 (1408022723204)
Finished the test on host x.x.x.x # Thu Aug 14 10:28:23 BRT 2014 (1408022903204)
Starting the test on host x.x.x.x # Thu Aug 14 10:33:13 BRT 2014 (1408023193224)
Finished the test on host x.x.x.x # Thu Aug 14 10:36:53 BRT 2014 (1408023413225)

Error using DBD::Oracle with instantclient 11.2

I Want to use perl module DBD::Oracle on Mac OS X 10.8.
I installed DBI through CPAN.
Downloaded the Oracle instant client 11.2 (basic, sqlplus and jdk).
Extracted it to /usr/local/oracle.
$ ls /usr/local/oracle/instantclient_11_2/
BASIC_README libnnz11.dylib ojdbc6.jar
SQLPLUS_README libocci.dylib.11.1 sdk
adrci libociei.dylib sqlplus
genezi libocijdbc11.dylib uidrvci
glogin.sql libsqlplus.dylib xstreams.jar
libclntsh.dylib libsqlplusic.dylib
libclntsh.dylib.11.1 ojdbc5.jar
Then installed DBD::Oracle.
Now when I want to use DBD::Oracle it gives an error.
install_driver(Oracle) failed: Can't load '/Library/Perl/5.12/darwin-thread-multi-
2level/auto/DBD/Oracle/Oracle.bundle' for module DBD::Oracle:
dlopen(/Library/Perl/5.12/darwin-thread-multi-2level/auto/DBD/Oracle/Oracle.bundle, 1):
Library not loaded: /ade/b/2649109290/oracle/rdbms/lib/libclntsh.dylib.11.1
Referenced from: /Library/Perl/5.12/darwin-thread-multi-
2level/auto/DBD/Oracle/Oracle.bundle
Reason: image not found at /System/Library/Perl/5.12/darwin-thread-multi-
2level/DynaLoader.pm line 204.
I have DYLD_LIBRARY_PATH=/usr/local/oracle/instaclient_11_2
I have not a clue what I am doing wrong.
SOLVED:
I got the same error when trying to run sqlplus. I added my oracle client directory to my global PATH variable and it is working now.
Saw they did the same in this tutorial: http://www.janhellevik.no/?p=521
Check this one out: perl DBD::Oracle Module installtion
Above information is about Linux Environment. But you might get some clues on how to go about configuring DBD::Oracle on MAC OSX.
On linux, you need "Basic, SQLPLUS and Devel" binaries of the oracle instant client. Here is the directory listing on my Linux box:
# pwd
/usr/lib/oracle/11.2/client64/lib
# ls -l
total 185232
-rw-r--r-- 1 root root 368 Sep 17 2011 glogin.sql
lrwxrwxrwx 1 root root 17 Jul 9 2012 libclntsh.so -> libclntsh.so.11.1
-rw-r--r-- 1 root root 52761218 Sep 17 2011 libclntsh.so.11.1
-rw-r--r-- 1 root root 7955322 Sep 17 2011 libnnz11.so
lrwxrwxrwx 1 root root 15 Jul 9 2012 libocci.so -> libocci.so.11.1
-rw-r--r-- 1 root root 1971762 Sep 17 2011 libocci.so.11.1
-rw-r--r-- 1 root root 118408281 Sep 17 2011 libociei.so
-rw-r--r-- 1 root root 164836 Sep 17 2011 libocijdbc11.so
-rw-r--r-- 1 root root 1503303 Sep 17 2011 libsqlplusic.so
-rw-r--r-- 1 root root 1477446 Sep 17 2011 libsqlplus.so
-rw-r--r-- 1 root root 2095661 Sep 17 2011 ojdbc5.jar
-rw-r--r-- 1 root root 2714016 Sep 17 2011 ojdbc6.jar
-rw-r--r-- 1 root root 300666 Sep 17 2011 ottclasses.zip
-rw-r--r-- 1 root root 66779 Sep 17 2011 xstreams.jar
and here is the list of oracle instant client RPMs that I installed:
# rpm -qa | grep -i oracle
oracle-instantclient11.2-basic-11.2.0.3.0-1
oracle-instantclient11.2-devel-11.2.0.3.0-1
oracle-instantclient11.2-sqlplus-11.2.0.3.0-1
Hope this helps.

Mongodb takes 3 minutes to connect

Just reinstalled Mongodb on my mac (fresh install of mountain lion 10.8) and now my apps are taking ~3 mins to connect.
I put together a simple node script to test this:
var start = (new Date()).getTime();
var mongoose = require('mongoose');
var db = mongoose.connect('mongodb://localhost/passport-mongox',function(err){
var stop = (new Date()).getTime();
console.log('Took this long: ',(stop-start) / 1000 );
});
Both times were 175.273 and 175.316 seconds.
When I connect to an external, hosted mongodb it connects in less than a second,
Any idea why this would happen? Here is my mongo.log:
Fri Feb 1 12:43:25 [initandlisten] MongoDB starting : pid=2262 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=w
Fri Feb 1 12:43:25 [initandlisten] db version v2.2.2, pdfile version 4.5
Fri Feb 1 12:43:25 [initandlisten] git version: d1b43b61a5308c4ad0679d34b262c5af9d664267
Fri Feb 1 12:43:25 [initandlisten] build info: Darwin bs-osx-106-x86-64-1.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_49
Fri Feb 1 12:43:25 [initandlisten] options: { bind_ip: "127.0.0.1", config: "/usr/local/etc/mongod.conf", dbpath: "/usr/local/var/mongodb", logappend: "true", logpath: "/usr/local/var/log/mongodb/mongo.log" }
Fri Feb 1 12:43:25 [initandlisten] journal dir=/usr/local/var/mongodb/journal
Fri Feb 1 12:43:25 [initandlisten] recover : no journal files present, no recovery needed
Fri Feb 1 12:43:26 [websvr] admin web console waiting for connections on port 28017
Fri Feb 1 12:43:26 [initandlisten] waiting for connections on port 27017
Fri Feb 1 12:44:05 [initandlisten] connection accepted from 127.0.0.1:52137 #1 (1 connection now open)
Fri Feb 1 12:44:40 [initandlisten] connection accepted from 127.0.0.1:52152 #2 (2 connections now open)
Fri Feb 1 12:45:15 [initandlisten] connection accepted from 127.0.0.1:52201 #3 (3 connections now open)
Fri Feb 1 12:45:50 [initandlisten] connection accepted from 127.0.0.1:52298 #4 (4 connections now open)
Fri Feb 1 12:46:25 [initandlisten] connection accepted from 127.0.0.1:52325 #5 (5 connections now open)
Fri Feb 1 12:51:26 [conn5] end connection 127.0.0.1:52325 (4 connections now open)
Fri Feb 1 12:51:26 [conn3] end connection 127.0.0.1:52201 (4 connections now open)
Fri Feb 1 12:51:26 [conn4] end connection 127.0.0.1:52298 (4 connections now open)
Fri Feb 1 12:51:26 [conn1] end connection 127.0.0.1:52137 (4 connections now open)
Fri Feb 1 12:51:26 [conn2] end connection 127.0.0.1:52152 (4 connections now open)
Answer from mongoose.js
Cause:
The underlying MongoDB driver defaults to looking for IPv6 addresses,
so the most likely cause is that your localhost DNS mapping isn't configured to handle IPv6.
Solution :
Use 127.0.0.1 instead of localhost or use the family option as shown in the connection docs.
mongoose.connect(url, {family:4}, function(err, connection) {
connection.db(your_db_name);
});
So the answer came from #AdamMeghji on twitter.
My hosts file has always looked like this:
127.0.0.1 localhost
127.0.0.1 test.com
127.0.0.1 wes.dev
I switched that to:
127.0.0.1 localhost test.com wes.dev
and connections went back to 0.015 seconds.

Resources