{"id":32200083,"url":"https://github.com/atalv/azlogr","last_synced_at":"2026-05-16T06:37:51.683Z","repository":{"id":65207604,"uuid":"547043938","full_name":"atalv/azlogr","owner":"atalv","description":"Logging in 'R' and Post to 'Azure Log Analytics' Workspace","archived":false,"fork":false,"pushed_at":"2024-03-21T04:31:27.000Z","size":4159,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-09T11:53:13.916Z","etag":null,"topics":["azure","azure-log-analytics","cran","logging","r","rstats"],"latest_commit_sha":null,"homepage":"https://atalv.github.io/azlogr/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atalv.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-10-07T03:45:02.000Z","updated_at":"2023-01-31T20:33:43.000Z","dependencies_parsed_at":"2025-09-08T16:34:28.825Z","dependency_job_id":null,"html_url":"https://github.com/atalv/azlogr","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/atalv/azlogr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atalv%2Fazlogr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atalv%2Fazlogr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atalv%2Fazlogr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atalv%2Fazlogr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atalv","download_url":"https://codeload.github.com/atalv/azlogr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atalv%2Fazlogr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33092802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","azure-log-analytics","cran","logging","r","rstats"],"created_at":"2025-10-22T03:37:55.496Z","updated_at":"2026-05-16T06:37:51.678Z","avatar_url":"https://github.com/atalv.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# azlogr\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\n[![CRAN status](https://www.r-pkg.org/badges/version/azlogr)](https://CRAN.R-project.org/package=azlogr)\n[![Codecov test coverage](https://codecov.io/gh/atalv/azlogr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/atalv/azlogr?branch=main)\n[![R-CMD-check](https://github.com/atalv/azlogr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/atalv/azlogr/actions/workflows/R-CMD-check.yaml)\n[![](https://cranlogs.r-pkg.org/badges/azlogr?color=blue)](https://cran.r-project.org/package=azlogr)\n\u003c!-- badges: end --\u003e\n\nThe goal of `azlogr` is to enable logging in 'R' and easily send the logging messages to 'Azure Log Analytics' workspace in real-time. It also shows the logging message on 'R' console, which makes it easier to see the logs in the same place where 'R' codes are executed. It will be easier for somebody to retrieve the historical logs in 'Azure Log Analytics', if needed, and compare.  \n\nThis is an extension of the [`'logger'`](https://daroczig.github.io/logger/) package, see this article: `vignette(\"Intro\", package = \"logger\")` for an introduction about that package. You may set the logging threshold using `logger::log_threshold()` function from `'logger'` package while initiating a session.  \n\nMoreover, there is an option provided to add additional custom meta-data while logging, which can be helpful at times.\n\n## Installation\n\nYou can install the latest version of `azlogr` as published on [CRAN](https://cran.r-project.org/package=azlogr/) with:\n\n```{r install_cran, eval = FALSE}\ninstall.packages(\"azlogr\")\n```\n\nOr, install the latest development version of `azlogr` from [GitHub](https://github.com/) with:\n\n```{r install_dev, eval = FALSE}\ninstall.packages(\"devtools\")\ndevtools::install_github(\"atalv/azlogr\")\n```\n\n## Example\n\nBelow is shown a simple way to use the logging mechanism. Please refer the vignette article of this package, `vignette(\"how-to-use-azlogr\")`, to know more on how to configure 'Azure Log Analytics' workspace credentials and use this package easily.\n\n```{r example_basic}\nlibrary(azlogr)\nset_log_config(log_to_azure = FALSE)\nlogger_info(\"logging info\")\n#\u003e {\"level\":\"INFO\",\"time\":\"2023-01-11 13:15:03\",\"msg\":\"logging info\"}\n```\n\n### Workflow\n\nAnd here is an example workflow of configuring the logging mechanism and using `logger_*` functions to log.\n\n```{r example, eval = FALSE}\n# Azure Log Analytics workspace id and shared key are fetched\n# from environment variables.\n# `Sys.setenv` is used only for demonstration purpose!!\nSys.setenv(AZ_LOG_ID = \"\u003center-your-Azure-Log-Analytics-workspace-id\u003e\")\nSys.setenv(AZ_LOG_KEY = \"\u003center-your-Azure-Log-Analytics-shared-key\u003e\")\n\nlibrary(azlogr)\n\n# Optionally, add additional meta-data, `country` and `id`, to be collected\n# while logging, on top of the default fields - 'level', 'time', 'msg'.\nset_log_config(\n  log_fields = c(\"level\", \"time\", \"msg\"),\n  additional_fields = list(country = \"in\", id = 123)\n)\n\n# Use logger_* functions with appropriate logging level to log.\n# If POST is successful, then it will be available in custom log table on\n# Azure Log Analytics, by default table name will be `log_from_r`_CL (_CL is\n# added by Azure for any custom log table)\nlogger_info(\"log info sent to Azure\")\n#\u003e {\"level\":\"INFO\",\"time\":\"2023-01-11 13:15:04\",\"msg\":\"log info sent to Azure\",\"country\":\"in\",\"id\":123}\n\n# If the POST request is unsuccessful due to Azure credential issue, then log\n# message is displayed on console and a warning is generated with error details.\nlogger_info(\"log info sent to Azure\")\n#\u003e {\"level\":\"INFO\",\"time\":\"2023-01-11 13:15:04\",\"msg\":\"log info sent to Azure\",\"country\":\"in\",\"id\":123}\n#\u003e Warning message:\n#\u003e In logger_level(logger::INFO, ...) :\n#\u003e   Some error happened while sending POST request to 'Azure Log Analytics' workspace.\n#\u003e Error message: Error in curl::curl_fetch_memory(url, handle = handle) :\n#\u003e   Could not resolve host: abcd.ods.opinsights.azure.com\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatalv%2Fazlogr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatalv%2Fazlogr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatalv%2Fazlogr/lists"}