Giter VIP home page Giter VIP logo

azurenetworkwatchernsgflowlogsconnector's Introduction

This project installs into an Azure Function in your Azure subscription. Its job is to read NSG Flow Logs from your configured storage account, break the data into chunks that are the right size for your log analytics system to ingest, then transmit the chunks to that system. At present, you may choose from four output bindings: ArcSight, LogStash, Splunk HEC, Event Hub.

Deploy to Azure

NOTE regarding the Event Hub output binding:

Native support for event hubs is not yet available, but would be the preferred method. If you use Splunk and prefer to send NSG flow logs to Splunk using event hub rather than HEC, the event hub output binding will do the job. In Azure Monitor Addon For Splunk, configure the Azure Monitor Diagnostic Logs data input and add a line to TA-folder/bin/app/hubs.json similar to this:

Example: 'insights-logs-nsgflowlogs': 'resourceId'

When you create the hub (e.g. insights-logs-nsgflowlogs) set the number of partitions to 4. This is mandatory.

Settings

In the Application Settings of your Azure Function:

  • AppName - this is the name of the function app. In the Azure Portal, this is the name that will appear in the list of resources.
    Example: MyNSGApp
  • appServicePlan - "ServicePlan" or "Consumption".
    If you select "ServicePlan", an App Service Plan will be created and you will be billed accordingly. If you select "Consumption", you will be billed based on the Consumption plan.
  • appServicePlanTier - "Free", "Shared", "Basic", "Standard", "Premium", "PremiumV2"
    Example: Standard
    (only relevant for ServicePlan)
  • appServicePlanName - depends on tier, for full details see "Choose your pricing tier" in the portal on an App service plan "Scale up" applet.
    Example: For standard tier, "S1", "S2", "S3" are options for plan name
    (only relevant for ServicePlan)
  • appServicePlanCapacity - how many instances do you want to set for the upper limit?
    Example: For standard tier, S2, set a value from 1 to 10
    (only relevant for ServicePlan)
  • githubRepoURL - this is the URL of the repo that contains the function app source. You would put your fork's address here.
    Example: https://github.com/microsoft/AzureNetworkWatcherNSGFlowLogsConnector
  • githubRepoBranch - this is the name of the branch containing the code you want to deploy.
    Example: master
  • nsgSourceDataConnection - a storage account connection string
    Example: DefaultEndpointsProtocol=https;AccountName=yyy;AccountKey=xxx;EndpointSuffix=core.windows.net
  • cefLogAccount - a storage account connection string - account into which trace logs of incoming json and outgoing cef are dropped
    Example: DefaultEndpointsProtocol=https;AccountName=yyy;AccountKey=xxx;EndpointSuffix=core.windows.net
  • outputBinding - Points to the destination service - the service that will receive the NSG flow log data. Options are "arcsight", "splunk", "eventhub", "logstash".
    Example: arcsight
  • arcsightAddress - internet address of the ArcSight server / service
    Example: 192.168.1.1
  • arcsightPort - TCP port to connect to on destination server / service
    Example: 1514
  • splunkAddress - internet address of the Splunk HEC port.
    Example: http://mysplunkbox.uksouth.cloudapp.azure.com:8088/services/collector
  • splunkToken - guid security token for Splunk HEC
    Example: a77fdc21-0861-4d8b-941c-e1b4c556b4fb
  • eventHubConnection - connection string for your event hub namespace
    Example: Endpoint=sb://my.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=key
  • eventHubName - name of your event hub within the hub namespace
    Example: insights-logs-nsgflowlogs
  • logstashAddress - network address of LogStash input endpoint
    Example: http://myelasticbox.uksouth.cloudapp.azure.com/
  • logstashHttpUser - userid for LogStash http input
    Example: greg
  • logstashHttpPwd - password for LogStash http input
    Example: P@ssw0rd!

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

azurenetworkwatchernsgflowlogsconnector's People

Contributors

chrismon avatar microsoftopensource avatar msftgits avatar sagar027 avatar sebastus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azurenetworkwatchernsgflowlogsconnector's Issues

NSG Flow Logs to Event Hub

Hello. It appears that the option to send the flow logs directly to an Azure Event Hub were added to this code, but when attempting to use it the events don't appear to be getting picked up by the Event Hub. Is that functionality possible now using this function app deployment?

Invalid sku value

I am trying to deploy this function with a consumption plan. Although, the App Service Plan Tier and Name is Optional i still get an error asking for specifying Service Plan Tier .

Once I specify a Free tier I get this error in my deployment:

"Message": "The parameter sku has an invalid value.",

Failute upgrading existing Function Apps

I have 5 deployed Function Apps running commit (5464209).
I've just resynced so the latest commit can deploy, but it's failed with the below errors (on 2 independent apps).

Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.WebJobs.Extensions.Storage, Version=4.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' [D:\home\site\repository\NwNsgProject\NwNsgProject.csproj]

deploy log.txt

Any ideas?

How does the function get triggered?

Does this function read the NSG logs once, then stops?
Does it register some kind of hook to get triggered every blob update?

I have 4 independent functions setup, looking at 4 different storage accounts. They share an app service plan. But the seem to process once, then stop.
I don't know enough about how this is working to know if this is intended behaviour or i'm missing something.

NSG Flow Logs to Event Hub no Messages are Being Received

Message count in Event Hubs is zero, where as requests are being received. I am not sure whats wrong, Flow logs are being dumped to a Storage account, I have added its connection string to the functions app, I have defined connection sting for the EventHub namespace and EventHub name in the function. I am using consumption plan.

Version 2 NSGFlowLogTuple Schema broke build during Functions Deploy

It would appear that the addition of the version parameter in the August changes causes the project build to fail.

Using shared compilation with compiler from directory: D:\Program Files (x86)\MSBuild-15.3.409.57025\MSBuild\15.0\Bin\Roslyn
Stage1BlobTrigger.cs(50,20): warning CS0168: The variable 'msg' is declared but never used [D:\home\site\repository\NwNsgProject\NwNsgProject.csproj]
Stage3QueueTrigger.cs(484,45): error CS7036: There is no argument given that corresponds to the required formal parameter 'version' of 'NSGFlowLogTuple.NSGFlowLogTuple(string, float)' [D:\home\site\repository\NwNsgProject\NwNsgProject.csproj]
Done Building Project "D:\home\site\repository\NwNsgProject\NwNsgProject.csproj" (default targets) -- FAILED.

Getting conflict error

Getting conflict error during deployment.

Resource - NSGFlowLogsApp/web (NSGFlowLogsApp is the AppName)
Type - Microsoft.Web/sites/sourcecontrols
Status - Conflict

Can someone please help?

Conflict on /web deployment

We have an error "conflict" during app deployment on the resource "appName/web"

The resource type is "Microsoft.Web/sites/sourcecontrols"

Any idea ?

Thank you,

screencaperror

Possibility to use 1 function for multiple blobs

Hello,
I am wondering if it's possible to use the same function for sending multiple blob to the same eventhub?
From what I understand , we need to create 1 function per blob and send them all to the same eventhub.
Thanks!

Duplicate records in eventhub message

We are seeing 2 duplicate records per event hub message. Is this by design or is there an issue? This is our first time using this function app. Any assistance would be appreciated.

sample message in eventhub:
{ body: '{"records":[{"time":"2021-09-10T20:02:30.0094229Z","category":"NetworkSecurityGroupFlowEvent","operationName":"NetworkSecurityGroupFlowEvents","resourceId":"/SUBSCRIPTIONS/F9EA7F5D-324F-4C97-8B60-6734F9DC6F76/RESOURCEGROUPS/SIC-DEMO-DEV/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/SICDEMO-NSG","version":2.0,"nsgRuleName":"DefaultRule_AllowVnetInBound","mac":"000D3A3CECED","startTime":"1631304101","sourceAddress":"172.16.0.9","destinationAddress":"172.16.0.11","sourcePort":"61914","destinationPort":"80","transportProtocol":"T","deviceDirection":"I","deviceAction":"A","flowState":"B"},{"time":"2021-09-10T20:02:30.0094229Z","category":"NetworkSecurityGroupFlowEvent","operationName":"NetworkSecurityGroupFlowEvents","resourceId":"/SUBSCRIPTIONS/F9EA7F5D-324F-4C97-8B60-6734F9DC6F76/RESOURCEGROUPS/SIC-DEMO-DEV/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/SICDEMO-NSG","version":2.0,"nsgRuleName":"DefaultRule_AllowVnetInBound","mac":"000D3A3CECED","startTime":"1631304101","sourceAddress":"172.16.0.9","destinationAddress":"172.16.0.11","sourcePort":"61914","destinationPort":"80","transportProtocol":"T","deviceDirection":"I","deviceAction":"A","flowState":"B"}]}', properties: None, offset: 355480, sequence_number: 275, enqueued_time=datetime.datetime(2021, 9, 13, 16, 37, 12, 592000, tzinfo=datetime.timezone.utc) }

Missing Logstash

In the template for custom deployment, I have selected "Logstash" for the Output binding, but don't seen anything for the connection settings. Only Arksight, Splunk and Event Hub.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.