Skip to content

Custom Log Files

Jeff Johnson edited this page Oct 13, 2020 · 6 revisions

C# Integration

If you have custom software that you want to log failed or successful logins with, you can use https://github.com/DigitalRuby/IPBan/blob/master/IPBanCore/IPBanPlugin.cs. This plugin makes it easy to write a failed or successful login with custom software. For example, https://github.com/DigitalRuby/MailDemon uses the plugin to log failed and successful SMTP and HTTPS attempts that IPBan can then pickup and deal with.

Simply call IPBanLoginFailed or IPBanLoginSucceeded from your application.

For Windows, the event viewer will be used. On Linux, /var/log/ipbancustom_{processName}.log will be used.

Other Integrations

For other programming languages besides C#, the plugin is super lightweight and should be easy to port, just use the same file name and line format for writing to the log file and you should be good to go.

Log file format

Failed logins:

2020-01-01T01:01:01Z, ipban failed login, ip address: 10.10.10.10, source: RDP, user: FailedUserName[newline]

Successful logins:

2020-01-01T01:01:01Z, ipban success login, ip address: 10.10.10.10, source: RDP, user: SuccessUserName[newline]
  • Spacing is important, each comma and colon should have a space after it.
  • The timestamp at the beginning is an ISO-8601 standard date string.
  • The ip address is required.
  • The source can be RDP, SSH, SMTP, or whatever source makes sense for the type of log.
  • The newline in the example is simply a \r\n (carriage return, line feed without the brackets).
  • If you don't have the timestamp, you can leave it and the leading comma and space off entirely.
  • If you don't have the source or user, you can leave the values blank, but you still need to provide the source: , or user: prefix.

Log file location and naming convention

For Windows, the path to put your custom log files is C:/IPBanCustomLogs/*.log  
For Linux, the path to put your custom log files in is /var/log/ipbancustom*.log

You can name the file whatever you want and make as many as you want as long as they are in the correct folder and match the naming convention (*.log on Windows and ipbancustom*.log on Linux).