How can I let nginx log the used SSL/TLS protocol and ciphersuite?

118

Add $ssl_cipher to your log_format configuration.

Refer to http://nginx.org/en/docs/http/ngx_http_ssl_module.html#variables for all SSL-related variables.

Example

Define a custom log_format in the http context (e.g. /etc/nginx/nginx.conf):

log_format combined_ssl '$remote_addr - $remote_user [$time_local] '
                        '$ssl_protocol/$ssl_cipher '
                        '"$request" $status $body_bytes_sent '
                        '"$http_referer" "$http_user_agent"';

The above is based on the default combined format with an additional '$ssl_protocol/$ssl_cipher ' line.

Then add in a server context (with SSL enabled) the access_log directive with the custom log format:

server {
  listen 443;
  ssl on;
  access_log /var/log/nginx/access.log combined_ssl;
  [...]
}

After restarting nginx, logs appear like:

10.1.2.3 - - [13/Aug/2014:12:34:56 +0200] TLSv1.2/ECDHE-RSA-AES128-GCM-SHA256 "GET / HTTP/1.1" 200 1234 "-" "User agent bla"
Share:
118

Related videos on Youtube

nickcoding
Author by

nickcoding

Updated on September 18, 2022

Comments

  • nickcoding
    nickcoding over 1 year

    I have a view called SearchResults. It should update whenever the ObservedObject passed into it changes, but the View is not updating with the new values and I'm not sure why.

    import SwiftUI
    
    struct SearchResults: View {
        @ObservedObject var VModel: ViewModel
        var body: some view {
            List {
                ForEach(self.VModel.searchResults, id: \.self) { result in 
                    Text(result)
                }
            }
        }
    }
    
    
    class ViewModel: ObservableObject {
        @Published var searchResults: [String] = []
    
        func findResults() {
            //Do the update to 'searchResults' here
            //This function is called at another point in the code in a pretty big file...I think it might make it more confusing to have like a couple hundred more lines of code in here
        }
    }
    

    Side Note: VModel has an array of type [String] called searchResults, and I thought this view should update whenever the searchResults array is updated..?

    • New Dev
      New Dev about 4 years
      Does the property searchResults have @Published property wrapper?
    • nickcoding
      nickcoding about 4 years
      @NewDev Yes it does
    • OOPer
      OOPer about 4 years
      Can you show a full code to reproduce the issue?
    • nickcoding
      nickcoding about 4 years
      @OOPer I updated it a little bit, I'm not sure if you want the whole code or not, because it's hundreds of lines
    • New Dev
      New Dev about 4 years
      @nickcoding - i don't see anything in this code to indicate a problem. Try to create a minimal reproducible example
    • OOPer
      OOPer about 4 years
      Sorry, but I want to see a code enough to reproduce your issue. With filling up your findResults() and some other parts with the right code to run your code shown, nothing like you have described happens and the View is updated correctly. You have something wrong where you have not shown yet.