AuditLogLocation Enumeração

Definição

Especifica o local em que os logs de eventos relacionados à segurança são gravados.

public enum class AuditLogLocation
public enum AuditLogLocation
type AuditLogLocation = 
Public Enum AuditLogLocation
Herança
AuditLogLocation

Campos

Application 1

Especifica o log de Aplicativo no log de eventos.

Default 0

Especifica o local padrão, que é determinado pelo sistema operacional. Se houver suporte para gravar no log de segurança (como em Windows Vista e Windows Server 2003 e plataformas posteriores), o local de log padrão será o log de segurança. Caso contrário (como no Windows XP SP2), o local de log padrão é o log de aplicativos.

Security 2

Especifica o log de Segurança no log de eventos. O thread de chamada deve ter SeAuditPrivilege para ser capaz de gravar no log de Segurança.

Exemplos

O exemplo a seguir define a ServiceSecurityAuditBehavior.AuditLogLocation propriedade como um dos AuditLogLocation valores:

public static void Main()
{
    // Get base address from appsettings in configuration.
    Uri baseAddress = new Uri(ConfigurationManager.
        AppSettings["baseAddress"]);

    // Create a ServiceHost for the CalculatorService type
    // and provide the base address.
    using (ServiceHost serviceHost = new
        ServiceHost(typeof(CalculatorService), baseAddress))
    {
        // Create a new auditing behavior and set the log location.
        ServiceSecurityAuditBehavior newAudit =
            new ServiceSecurityAuditBehavior();
        newAudit.AuditLogLocation =
            AuditLogLocation.Application;
        newAudit.MessageAuthenticationAuditLevel =
            AuditLevel.SuccessOrFailure;
        newAudit.ServiceAuthorizationAuditLevel =
            AuditLevel.SuccessOrFailure;
        newAudit.SuppressAuditFailure = false;
        // Remove the old behavior and add the new.
        serviceHost.Description.
            Behaviors.Remove<ServiceSecurityAuditBehavior>();
        serviceHost.Description.Behaviors.Add(newAudit);
        // Open the ServiceHostBase to create listeners
        // and start listening for messages.
        serviceHost.Open();

        // The service can now be accessed.
        Console.WriteLine("The service is ready.");
        Console.WriteLine("Press <ENTER> to terminate service.");
        Console.WriteLine();
        Console.ReadLine();

        // Close the ServiceHostBase to shutdown the service.
        serviceHost.Close();
    }
}
Public Shared Sub Main() 
    ' Get base address from appsettings in configuration.
    Dim baseAddress As New Uri(ConfigurationManager.AppSettings("baseAddress"))
    
    ' Create a ServiceHost for the CalculatorService type 
    ' and provide the base address.
    Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)
    Try
        ' Create a new auditing behavior and set the log location.
        Dim newAudit As New ServiceSecurityAuditBehavior()
        newAudit.AuditLogLocation = AuditLogLocation.Application
        newAudit.MessageAuthenticationAuditLevel = _
            AuditLevel.SuccessOrFailure
        newAudit.ServiceAuthorizationAuditLevel = _
            AuditLevel.SuccessOrFailure
        newAudit.SuppressAuditFailure = False
        ' Remove the old behavior and add the new.
        serviceHost.Description.Behaviors.Remove(Of ServiceSecurityAuditBehavior)
        serviceHost.Description.Behaviors.Add(newAudit)
        ' Open the ServiceHostBase to create listeners 
        ' and start listening for messages.
        serviceHost.Open()
        
        ' The service can now be accessed.
        Console.WriteLine("The service is ready.")
        Console.WriteLine("Press <ENTER> to terminate service.")
        Console.WriteLine()
        Console.ReadLine()
        
        ' Close the ServiceHostBase to shutdown the service.
        serviceHost.Close()
    Finally
    End Try

End Sub

Comentários

Ao criar um aplicativo do WCF (Windows Communication Foundation) que requer autenticação e/ou autorização de chamadores, você pode especificar que eventos relacionados à segurança sejam registrados para êxito, falha ou ambos. O local do log é determinado por essa enumeração.

O nível do log de auditoria é especificado definindo a MessageAuthenticationAuditLevel propriedade ou a ServiceAuthorizationAuditLevel propriedade da ServiceSecurityAuditBehavior classe como um dos AuditLevel valores.

Você também pode especificar o comportamento de auditoria usando a <associação serviceSecurityAudit> .

Importante

Se a AuditLogLocation propriedade estiver definida como Segurança e Audit Object Access não estiver definida no log de segurança, os Local Security Policyeventos de auditoria não serão gravados no log de segurança. Nenhuma falha é retornada, mas as entradas de auditoria não serão gravadas no log de segurança. Além disso, o thread de chamada deve SeAuditPrivilege ser capaz de gravar no log de segurança.

Padrão que depende do sistema operacional

Ao definir a propriedade como o valor padrão, o sistema operacional determina para qual log será realmente gravado. Para obter mais informações, consulte Auditoria.

Aplica-se a

Confira também