1

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

Kris Rice
  • 559
  • 1
  • 5
  • 23
  • Can you post an example of what it's logging? That way we can see what the code in either iscsiadm or iscsid is doing to generate the messages. – Mike Andrews Jun 13 '22 at 17:34
  • It sounds to me like your syslog daemon may be configured to send those messages; the sysadmin should be alerted to see if this is desired behavior or not, and involved in changing it. If you're the sysadmin, a syadmin-based site might be more appropriate than Stack Overflow; perhaps UNIX & Linux, Server Fault, or Super User. – Jeff Schaller Jun 14 '22 at 01:00
  • @MikeAndrews im afiraid not it contains confidential information. The log message itself is expected, "/dev/disk/by-path/.... does not exist". The java application is designed to continuously try and mount the device until it is mounted. The particular device is not inserted and the log appears as expected. The issue is that it floods all the virtual terminals because it's logging via dmesg, making the system unuasble for debugging – Kris Rice Jun 14 '22 at 12:47

1 Answers1

0

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.

Kris Rice
  • 559
  • 1
  • 5
  • 23