Prevent application (iscsiadm) logging to dmesg?

61 views Asked by At

I have an issue where running sudo iscsiadm -m discovery -t st -p IP -l logs to dmesg across all terminals on the server.

The command is run from a java application, using:

    Runtime.getRuntime().exec("/bin/bash", "-c", "sudo iscsiadm -m discovery -t st -p *IP* -l");

I have tried the following:

  1. Apppending > /dev/null 2>&1 to the end of the iscsiadm discovery... command
  2. Capturing input streams from the returned progress (process.getInputStream() and process.getErrorStream())
  3. Appending > /dev/null 2>&1 to the software launching the Jar.

None of the above attempts prevent logging across all virtual terminals. The log starts [some_num.some_dec] LOG_MESSAGE which suggests it is outputting to dmesg? If this is true how do I prevent this? Currently it makes the system impossible to debug because it's printing over the terminal prompt.

Thanks

1

There are 1 answers

0
Kris Rice On

Issue fixed.

It turns out it was not iscsiadm logging to dmesg, it was the mount command afterwards because the blockdev did not exist.

I have modified my java code to try iscsiadm -m discovery... then run iscsiadm -m session to determine if the appropriate device has a connection or not prior to mounting.