Skip to content

Blobfuse Logging

Gauri Prasad edited this page Oct 12, 2022 · 1 revision

Security warning

Log levels LOG_ERR through LOG_DEBUG will print the path to files for relevant operations to syslog. This means that anyone who has access to your syslog may be able to see names and directories of files. The higher the log level (with LOG_DEBUG being the highest), the more gets printed. Turn logging off if this not acceptable.

Logging overview

blobfuse will write various data to syslog. Simply grep for blobfuse: grep blobfuse /var/log/syslog. It uses five levels of severity:

  • LOG_CRIT - Issues that cause blobfuse to fail to start.

  • LOG_ERR - Issues that will end up returning errors to the caller. For example, if you write some data and then try to close the file handle, but blobfuse fails (for whatever reason) to properly connect to Azure Storage to commit the data, this event will be logged to syslog at level LOG_ERR (as well as returning a failure to the process attempting to close the file handle, of course.)

  • LOG_WARNING - Issues that blobfuse encounters that may not be actual errors, but still may be valuable to log. For example, if a network operation fails but is retriable, a warning may be logged before automatic retries kick in.

  • LOG_INFO - All operations relating to the uploading or downloading of blob data to Azure Storage are logged at LOG_INFO level. Some other operations are also logged at the level, that may be informative if problems are encountered.

  • LOG_DEBUG - Essentially trace statements for all calls into blobfuse. This is very verbose, and contains helpful debugging information such as line number, method name, method inputs and return values, etc. Probably only helpful if you are looking at the source code as well.

The default log level is LOG_WARNING. You can set the log level when you mount blobfuse by adding the parameter:

--log-level=LOG_OFF|LOG_CRIT|LOG_ERR|LOG_WARNING|LOG_INFO|LOG_DEBUG

to the mount command. LOG_OFF will shut off logging completely (specifically, it sets the log threshold for the process to LOG_EMERG, which we do not use.) Other options include all worse levels of severity (meaning, if you specify LOG_INFO, blobfuse will log all INFO, WARNING, ERR, and CRIT level messages.)

libfuse library provides a '-d' option in mount command to enable its verbose logging on the console. This will enable debug logs in library and print all system calls being made along with their return values on the console itself.

Syslog Redirection

By default blobfuse dumps its logs in '/var/log/syslog' file. To redirect logs to a separate file follow below instructions. Files required for these commands are part of the package or can be found in the source code under 'systemd' directory.

- copy 10-blobfuse.conf to /etc/rsyslog.d/

- copy blobfuse-logrotate to /etc/logrotate.d/

- restart rsyslog service

    - $> service rsyslog restart

Dynamic Logging

Default logging level of blobfuse is LOG_WARNING. User can set a different log level using 'logLevel' command line option. Once blobfuse is mounted, this logging level can be changed without un-mounting the container. To change the logging level follow below steps

- Edit the config file provided in the command line options

- Add/Modify 'logLevel' config in the config file, use any of the log levels mentioned above

    - e.g. 'logLevel LOG_DEBUG'

- Once desired logging level is set in the config file, save the config file

- Send a 'SIGUSR1` signal to blobfuse to update the logging level

    - $> kill -SIGUSR1 `pidof blobfuse`

To reset logging level back to what was provided in the command line, remove the 'logLevel' configuration from config file and send 'SIGUSR1` signal to blobfuse.