Too small to be put in separate post I will use this one "feature" post for putting all the little tricks I am using in my daily work. So when I remember something usefull or stumble on something new I't will go here...

  1. ldapsearch auto decode base64
  2. xenserver syslog level
  3. disable ipv6
  4. xen orchestra set NFS v4
  5. search string inside files

ldapsearch auto decode base64

When using ldapsearch and getting attribute values back coded in base64 It's nice and handy to have it auto decoded while your ldapsearch command is throwing output.

So just put into your .bashrc:

ldapsearch $* | perl -MMIME::Base64 -n -00 -e 's/\n +//g;s/(?<=:: )(\S+)/decode_base64($1)/eg;print'

And after that reload your .bashrc:

source .bashrc

Now whenever you use ldapsearch it will autodecode base64 values.

xenserver syslog level

There is still no way (at least not in XenCenter 7.3, later versions I haven't checked) to send custom level logs from xenserver into your central log server using GUI. Since default level is info you will be flooded with xapi info messages. Work around this is by manually editing rsyslog file on xenserver host /etc/rsyslog.d/xenserver.conf and at the end add:

.=warn;*.=crit;*.=err  @your.log.server

After that just restart rsyslog service with service rsyslog restart.

disable ipv6

To disable ipv6 put at the end in /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1 

Then restart sysctl:

sysctl -p

xen orchestra set NFS v4

If needed you can set NFS to use v4 for your remotes (default is v3)

sudo nano /opt/xen-orchestra/@xen-orchestra/fs/dist/nfs.js

And change line where mount command is to use v4:

return (0, _execa.default)('mount', ['-t', 'nfs', '-o', 'vers=4'....

After just restart xo-server:

sudo service xo-server restart

search string inside files

If you need to search specific string inside files:

grep -rnw '/path/to/start/search' -e 'string'