fmgd_log_setting – Configure general log settings.

Added in version 1.0.0.

Synopsis

  • This module is able to configure a FortiManager device.

  • Examples include all parameters and values need to be adjusted to data sources before usage.

  • Tested with FortiManager v7.x.

Requirements

The below requirements are needed on the host that executes this module.

  • ansible-core>=2.16.0

FortiManager Version Compatibility

Supported Version Ranges: v7.2.6 -> v7.2.12, v7.4.3 -> latest

Parameters

  • access_token -The token to access FortiManager without using username and password. type: str required: false
  • bypass_validation - Only set to True when module schema diffs with FortiManager API structure, module continues to execute without validating parameters. type: bool required: false default: False
  • enable_log - Enable/Disable logging for task. type: bool required: false default: False
  • forticloud_access_token - Access token of forticloud managed API users, this option is available with FortiManager later than 6.4.0. type: str required: false
  • proposed_method - The overridden method for the underlying Json RPC request. type: str required: false choices: set, update, add
  • rc_succeeded - The rc codes list with which the conditions to succeed will be overriden. type: list required: false
  • rc_failed - The rc codes list with which the conditions to fail will be overriden. type: list required: false
  • workspace_locking_adom - Acquire the workspace lock if FortiManager is running in workspace mode. type: str required: false choices: global, custom adom including root
  • workspace_locking_timeout - The maximum time in seconds to wait for other users to release workspace lock. type: integer required: false default: 300
  • device - The parameter in requested url type: str required: true
  • vdom - The parameter in requested url type: str required: true
  • log_setting - Configure general log settings. type: dict
    • anonymization_hash (Alias name: anonymization-hash) User name anonymization hash salt. type: str more...
    • brief_traffic_format (Alias name: brief-traffic-format) Enable/disable brief format traffic logging. type: str choices: [disable, enable] more...
    • custom_log_fields (Alias name: custom-log-fields) Custom fields to append to all log messages. type: list more...
    • daemon_log (Alias name: daemon-log) Enable/disable daemon logging. type: str choices: [disable, enable] more...
    • expolicy_implicit_log (Alias name: expolicy-implicit-log) Enable/disable explicit proxy firewall implicit policy logging. type: str choices: [disable, enable] more...
    • extended_log (Alias name: extended-log) Enable/disable extended traffic logging. type: str choices: [disable, enable] more...
    • faz_override (Alias name: faz-override) Enable/disable override fortianalyzer settings. type: str choices: [disable, enable] more...
    • fortiview_weekly_data (Alias name: fortiview-weekly-data) Enable/disable fortiview weekly data. type: str choices: [disable, enable] more...
    • fwpolicy_implicit_log (Alias name: fwpolicy-implicit-log) Enable/disable implicit firewall policy logging. type: str choices: [disable, enable] more...
    • fwpolicy6_implicit_log (Alias name: fwpolicy6-implicit-log) Enable/disable implicit firewall policy6 logging. type: str choices: [disable, enable] more...
    • local_in_allow (Alias name: local-in-allow) Enable/disable local-in-allow logging. type: str choices: [disable, enable] more...
    • local_in_deny_broadcast (Alias name: local-in-deny-broadcast) Enable/disable local-in-deny-broadcast logging. type: str choices: [disable, enable] more...
    • local_in_deny_unicast (Alias name: local-in-deny-unicast) Enable/disable local-in-deny-unicast logging. type: str choices: [disable, enable] more...
    • local_out (Alias name: local-out) Enable/disable local-out logging. type: str choices: [disable, enable] more...
    • local_out_ioc_detection (Alias name: local-out-ioc-detection) Enable/disable local-out traffic ioc detection. type: str choices: [disable, enable] more...
    • log_policy_comment (Alias name: log-policy-comment) Enable/disable inserting policy comments into traffic logs. type: str choices: [disable, enable] more...
    • log_user_in_upper (Alias name: log-user-in-upper) Enable/disable logs with user-in-upper. type: str choices: [disable, enable] more...
    • long_live_session_stat (Alias name: long-live-session-stat) Enable/disable long-live-session statistics logging. type: str choices: [disable, enable] more...
    • neighbor_event (Alias name: neighbor-event) Enable/disable neighbor event logging. type: str choices: [disable, enable] more...
    • resolve_ip (Alias name: resolve-ip) Enable/disable adding resolved domain names to traffic logs if possible. type: str choices: [disable, enable] more...
    • resolve_port (Alias name: resolve-port) Enable/disable adding resolved service names to traffic logs. type: str choices: [disable, enable] more...
    • rest_api_get (Alias name: rest-api-get) Enable/disable rest api get request logging. type: str choices: [disable, enable] more...
    • rest_api_set (Alias name: rest-api-set) Enable/disable rest api post/put/delete request logging. type: str choices: [disable, enable] more...
    • syslog_override (Alias name: syslog-override) Enable/disable override syslog settings. type: str choices: [disable, enable] more...
    • user_anonymize (Alias name: user-anonymize) Enable/disable anonymizing user names in log messages. type: str choices: [disable, enable] more...
    • log_invalid_packet (Alias name: log-invalid-packet) Enable/disable invalid packet traffic logging. type: str choices: [disable, enable] more...
    • log_policy_name (Alias name: log-policy-name) Enable/disable inserting policy name into traffic logs. type: str choices: [disable, enable] more...
    • extended_utm_log (Alias name: extended-utm-log) Enable/disable extended utm logging. type: str choices: [disable, enable] more...
    • local_in_policy_log (Alias name: local-in-policy-log) Enable/disable local-in-policy logging. type: str choices: [disable, enable] more...
    • rest_api_performance (Alias name: rest-api-performance) Enable/disable rest api memory and performance stats in rest-api-get/set logs. type: str choices: [disable, enable] more...
    • zone_name (Alias name: zone-name) Enable/disable zone name logging. type: str choices: [disable, enable] more...
    • web_svc_perf (Alias name: web-svc-perf) Enable/disable web-svc performance logging. type: str choices: [disable, enable] more...

Notes

Note

  • Running in workspace locking mode is supported in this FortiManager module, the top level parameters workspace_locking_adom and workspace_locking_timeout help do the work.

  • To create or update an object, use state: present directive.

  • To delete an object, use state: absent directive

  • Normally, running one module can fail when a non-zero rc is returned. you can also override the conditions to fail or succeed with parameters rc_failed and rc_succeeded

Examples

- name: Example playbook (generated based on argument schema)
  hosts: fortimanagers
  connection: httpapi
  gather_facts: false
  vars:
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_httpapi_port: 443
  tasks:
    - name: Configure general log settings.
      fortinet.fmgdevice.fmgd_log_setting:
        # bypass_validation: false
        # workspace_locking_adom: <global or your adom name>
        # workspace_locking_timeout: 300
        # rc_succeeded: [0, -2, -3, ...]
        # rc_failed: [-2, -3, ...]
        device: <your own value>
        vdom: <your own value>
        log_setting:
          # anonymization_hash: <string>
          # brief_traffic_format: <value in [disable, enable]>
          # custom_log_fields: <list or string>
          # daemon_log: <value in [disable, enable]>
          # expolicy_implicit_log: <value in [disable, enable]>
          # extended_log: <value in [disable, enable]>
          # faz_override: <value in [disable, enable]>
          # fortiview_weekly_data: <value in [disable, enable]>
          # fwpolicy_implicit_log: <value in [disable, enable]>
          # fwpolicy6_implicit_log: <value in [disable, enable]>
          # local_in_allow: <value in [disable, enable]>
          # local_in_deny_broadcast: <value in [disable, enable]>
          # local_in_deny_unicast: <value in [disable, enable]>
          # local_out: <value in [disable, enable]>
          # local_out_ioc_detection: <value in [disable, enable]>
          # log_policy_comment: <value in [disable, enable]>
          # log_user_in_upper: <value in [disable, enable]>
          # long_live_session_stat: <value in [disable, enable]>
          # neighbor_event: <value in [disable, enable]>
          # resolve_ip: <value in [disable, enable]>
          # resolve_port: <value in [disable, enable]>
          # rest_api_get: <value in [disable, enable]>
          # rest_api_set: <value in [disable, enable]>
          # syslog_override: <value in [disable, enable]>
          # user_anonymize: <value in [disable, enable]>
          # log_invalid_packet: <value in [disable, enable]>
          # log_policy_name: <value in [disable, enable]>
          # extended_utm_log: <value in [disable, enable]>
          # local_in_policy_log: <value in [disable, enable]>
          # rest_api_performance: <value in [disable, enable]>
          # zone_name: <value in [disable, enable]>
          # web_svc_perf: <value in [disable, enable]>

Return Values

Common return values are documented: https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values, the following are the fields unique to this module:

  • meta - The result of the request.returned: always type: dict
    • request_url - The full url requested. returned: always type: str sample: /sys/login/user
    • response_code - The status of api request. returned: always type: int sample: 0
    • response_data - The data body of the api response. returned: optional type: list or dict
    • response_message - The descriptive message of the api response. returned: always type: str sample: OK
    • system_information - The information of the target system. returned: always type: dict
  • rc - The status the request. returned: always type: int sample: 0
  • version_check_warning - Warning if the parameters used in the playbook are not supported by the current FortiManager version. returned: if at least one parameter not supported by the current FortiManager version type: list

Status

  • This module is not guaranteed to have a backwards compatible interface.

Authors

  • Xinwei Du (@dux-fortinet)

  • Xing Li (@lix-fortinet)

  • Jie Xue (@JieX19)

  • Link Zheng (@chillancezen)

  • Frank Shen (@fshen01)

  • Hongbin Lu (@fgtdev-hblu)