question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

az monitor diagnostic-settings create will not accept same json as returned by show for 'logs'

See original GitHub issue

Environment summary

Install Method: How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Answer here: script

CLI Version: What version of the CLI and modules are installed? (Use az --version)
Answer here: 2.0.3

OS Version: What OS and version are you using?
Answer here: Ubuntu 16.04 x64

Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here: bash


Description

The input to logs option for monitor create won’t accept the logs array as returned by ‘az monitor diagnostics-settings show’ - you have to strip out the ‘retentionPolicy’ elements. This seems incorrect.

Example in my case:

  "logs": [
    {
      "category": "ApplicationGatewayAccessLog",
      "enabled": false,
      "retentionPolicy": {
        "days": 0,
        "enabled": false
      }
    },
    {
      "category": "ApplicationGatewayPerformanceLog",
      "enabled": false,
      "retentionPolicy": {
        "days": 0,
        "enabled": false
      }
    },
    {
      "category": "ApplicationGatewayFirewallLog",
      "enabled": true,
      "retentionPolicy": {
        "days": 0,
        "enabled": false
      }
    }
  ],

It fails with:

u'retentionPolicy'
Traceback (most recent call last):
  File "/users/nneul/lib/azure-cli/local/lib/python2.7/site-packages/azure/cli/main.py", line 36, in main
    cmd_result = APPLICATION.execute(args)
  File "/users/nneul/lib/azure-cli/local/lib/python2.7/site-packages/azure/cli/core/application.py", line 201, in execute
    result = expanded_arg.func(params)
  File "/users/nneul/lib/azure-cli/local/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 403, in _execute_command
    raise ex
KeyError: u'retentionPolicy'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
nneulcommented, Apr 27, 2017

Confirmed that this is now working. Thank you!

0reactions
vishrutshahcommented, Apr 27, 2017

@nneul Closing the bug as PR is merged in. Could please use the nightly tomorrow and let us know whether things are good on you end or not. Appreciate your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

az monitor diagnostic-settings | Microsoft Learn
Commands; az monitor diagnostic-settings create; az monitor ... accepted values: 0, 1, f, false, n, no, t, true, y, yes. --logs. JSON encoded...
Read more >
app service create diagnostic settings using az cli
You can use the command az monitor diagnostic-settings categories list ... You can probably try the same JSON response however by replacing ...
Read more >
Manual Azure Activity Log Integration | Lacework Documentation
Lacework uses Azure Monitor's Diagnostic Settings, which exports the same type of logs in a folder named "insights-activity-logs". Inside is a folder ...
Read more >
azure-cli 2.14.1 - PyPI
Fix #12653: az webapp log config –application-logging false doesn't turn it off (#14929) ... az monitor diagnostic-settings create : support ...
Read more >
Six Tips for Azure Cloud Security - LogRhythm
The Azure Activity Log is a core part of Azure Monitor. ... It's a json formatted log, but at a glance, it doesn't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found